Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to insert a new row into the employees table.
MySQL
INSERT INTO employees (name, age) VALUES ([1], 30);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to use quotes around string values.
Using double quotes instead of single quotes.
✗ Incorrect
The value for a string must be enclosed in single quotes in SQL.
2fill in blank
mediumComplete the code to update the age of an employee named 'Alice'.
MySQL
UPDATE employees SET age = 28 WHERE name = [1];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around string values in WHERE clause.
Using double quotes instead of single quotes.
✗ Incorrect
String values in SQL conditions must be enclosed in single quotes.
3fill in blank
hardFix the error in the DELETE statement to remove employees older than 60.
MySQL
DELETE FROM employees WHERE age [1] 60;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong comparison operator.
Using equals instead of greater than.
✗ Incorrect
To delete employees older than 60, use the greater than operator (>).
4fill in blank
hardFill both blanks to select all employees with age {{BLANK_1}} 25 and name {{BLANK_2}} 'Bob'.
MySQL
SELECT * FROM employees WHERE age [1] 25 AND name = [2];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong comparison operator for age.
Not quoting the name string.
✗ Incorrect
We want employees older than 25 and named 'Bob'. Use > for age and 'Bob' in quotes for name.
5fill in blank
hardFill all three blanks to update the salary to {{BLANK_1}} for employee {{BLANK_3}} with id {{BLANK_2}}.
MySQL
UPDATE employees SET salary = [1] WHERE id = [2] AND name = [3];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Quoting numeric values.
Not quoting string values in WHERE clause.
✗ Incorrect
Set salary to 50000, filter by id 101 and name 'Emma' (quoted).