0
0
SQLquery~10 mins

UPDATE with expressions in SQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
A*
B-
C+
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-' will decrease the salary.
Using '*' or '/' will multiply or divide the salary, which is not intended.
2fill in blank
medium

Complete 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'
A+
B*
C-
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' will add 0.10 instead of calculating 10%.
Using '-' or '/' will not calculate the percentage correctly.
3fill in blank
hard

Fix 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'
A-
B+
C*
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' will increase the quantity instead of decreasing.
Using '*' or '/' will multiply or divide the quantity, causing errors.
4fill in blank
hard

Fill 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'
A*
B+
C-
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' will add instead of multiply.
Using '-' or '/' will subtract or divide values incorrectly.
5fill in blank
hard

Fill 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'
A*
B+
C-
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' instead of '-' will add discount incorrectly.
Using '*' or '/' for subtraction will cause errors.