0
0
SQLquery~10 mins

UPDATE with WHERE condition 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 update the salary of employees in the 'employees' table.

SQL
UPDATE employees SET salary = 50000 WHERE id = [1];
Drag options to blanks, or click blank then click option'
A'10'
B10
Csalary
Dname
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around numeric IDs.
Using column names instead of values in WHERE.
2fill in blank
medium

Complete the code to update the status of orders where the order date is before 2023-01-01.

SQL
UPDATE orders SET status = 'shipped' WHERE order_date [1] '2023-01-01';
Drag options to blanks, or click blank then click option'
A>
B=
C<
D>=
Attempts:
3 left
💡 Hint
Common Mistakes
Using > instead of < for dates before a certain day.
Using = which only matches exact dates.
3fill in blank
hard

Fix the error in the code to update the quantity of products where the product name is 'Widget'.

SQL
UPDATE products SET quantity = 100 WHERE product_name = [1];
Drag options to blanks, or click blank then click option'
A'Widget'
BWidget
C"Widget"
Dproduct_name
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around string values.
Using double quotes which may not work in all SQL dialects.
4fill in blank
hard

Fill both blanks to update the price of items where the category is 'Books'.

SQL
UPDATE items SET price = [1] WHERE category = [2];
Drag options to blanks, or click blank then click option'
A19.99
B'Books'
CBooks
Dprice
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around numbers.
Not putting quotes around string values.
5fill in blank
hard

Fill all three blanks to update the 'status' to 'active' for users with age greater than 30.

SQL
UPDATE users SET [1] = [2] WHERE [3] > 30;
Drag options to blanks, or click blank then click option'
Astatus
B'active'
Cage
Dusername
Attempts:
3 left
💡 Hint
Common Mistakes
Using column names instead of values.
Not quoting string values.
Using wrong column in WHERE clause.