Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to select all columns from a table named users.
PostgreSQL
SELECT [1] FROM users; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ALL' instead of '*' causes syntax error.
Writing 'COLUMNS' or 'EVERYTHING' is not valid SQL.
✗ Incorrect
The asterisk (*) means select all columns from the table.
2fill in blank
mediumComplete the code to create a new table named products with an id column.
PostgreSQL
CREATE TABLE [1] (id SERIAL PRIMARY KEY); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong table names like 'items' or 'orders'.
Misspelling the table name.
✗ Incorrect
The table name should be 'products' as requested.
3fill in blank
hardFix the error in the query to get the count of rows in the users table.
PostgreSQL
SELECT COUNT([1]) FROM users; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a column name that may have nulls, causing wrong counts.
Using 'all' which is not valid syntax.
✗ Incorrect
Using COUNT(*) counts all rows regardless of column values.
4fill in blank
hardFill all three blanks to select name and age from people where age is greater than 30.
PostgreSQL
SELECT [1], [2] FROM people WHERE age [3] 30;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' in the WHERE clause.
Selecting wrong columns or missing commas.
✗ Incorrect
Select 'name' and 'age' columns and filter rows where age is greater than 30.
5fill in blank
hardFill all three blanks to insert a new user with name 'Alice' and age 25 into the users table.
PostgreSQL
INSERT INTO users ([1], [2]) VALUES ([3], 25);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting numeric values in quotes.
Mixing up column names and values.
✗ Incorrect
Insert into columns 'name' and 'age' the values 'Alice' and 25 respectively.