Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to increase the salary by 1000 for all employees.
SQL
UPDATE employees SET salary = salary [1] 1000;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-' will decrease the salary.
Using '*' or '/' will multiply or divide the salary, which is not intended.
✗ Incorrect
The plus sign (+) adds 1000 to the current salary value.
2fill in blank
mediumComplete the code to set the bonus to 10% of the current salary.
SQL
UPDATE employees SET bonus = salary [1] 0.10;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' will add 0.10 instead of calculating 10%.
Using '-' or '/' will not calculate the percentage correctly.
✗ Incorrect
The asterisk (*) multiplies the salary by 0.10 to calculate 10% bonus.
3fill in blank
hardFix the error in the code to decrease the stock quantity by 5.
SQL
UPDATE inventory SET quantity = quantity [1] 5 WHERE product_id = 101;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' will increase the quantity instead of decreasing.
Using '*' or '/' will multiply or divide the quantity, causing errors.
✗ Incorrect
The minus sign (-) subtracts 5 from the current quantity.
4fill in blank
hardFill both blanks to double the price and set the discount to 20%.
SQL
UPDATE products SET price = price [1] 2, discount = price [2] 0.20;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' will add instead of multiply.
Using '-' or '/' will subtract or divide values incorrectly.
✗ Incorrect
Price is doubled by multiplying by 2. Discount is set to 20% of price by multiplying by 0.20.
5fill in blank
hardFill the blanks to update the total as quantity times price minus discount.
SQL
UPDATE sales SET total = (quantity [1] price) [2] discount WHERE sale_id = 500;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' instead of '-' will add discount incorrectly.
Using '*' or '/' for subtraction will cause errors.
✗ Incorrect
Total is calculated by multiplying quantity and price, then subtracting discount.