Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to select all columns from the table named 'employees'.
PostgreSQL
SELECT [1] FROM employees; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ALL' instead of '*'
Writing 'columns' which is not valid SQL syntax
✗ Incorrect
The asterisk (*) means select all columns from the table.
2fill in blank
mediumComplete the code to insert a new row into the 'employees' table with name 'John' and age 30.
PostgreSQL
INSERT INTO employees (name, age) VALUES ([1]); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around string values
Including extra parentheses inside VALUES
✗ Incorrect
Values must be in parentheses and strings in single quotes. Numbers do not need quotes.
3fill in blank
hardFix the error in the code to update the age of employee 'John' to 31.
PostgreSQL
UPDATE employees SET age = [1] WHERE name = 'John';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting numbers in quotes
Using double quotes instead of single quotes for strings
✗ Incorrect
Numbers should not be in quotes in SQL UPDATE statements.
4fill in blank
hardFill both blanks to delete rows where age is less than 25.
PostgreSQL
DELETE FROM employees WHERE age [1] [2];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using greater than symbol instead of less than
Using wrong number for comparison
✗ Incorrect
The condition deletes rows where age is less than 25.
5fill in blank
hardFill all three blanks to select the name and age of employees older than 40.
PostgreSQL
SELECT [1], [2] FROM employees WHERE age [3] 40;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting only one column
Using less than symbol instead of greater than
✗ Incorrect
Select the columns 'name' and 'age' and filter where age is greater than 40.