Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to select all columns from a table named 'users'.
MySQL
SELECT [1] FROM users; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using words like 'all' or 'columns' instead of '*'
Leaving the blank empty
✗ Incorrect
In SQL, * means select all columns from the table.
2fill in blank
mediumComplete the code to create a table named 'products' with an integer 'id' column as primary key.
MySQL
CREATE TABLE products (id [1] PRIMARY KEY); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using text types like TEXT or VARCHAR for numeric IDs
Using FLOAT which allows decimals
✗ Incorrect
The INT type is used for integer numbers, suitable for an ID column.
3fill in blank
hardFix the error in the query to get the count of rows in 'orders'.
MySQL
SELECT COUNT([1]) FROM orders; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using words like 'all' or 'rows' which cause errors
Using a specific column name which may miss NULL values
✗ Incorrect
Using COUNT(*) counts all rows in the table.
4fill in blank
hardFill both blanks to select the name and price from 'items' where price is greater than 100.
MySQL
SELECT [1], price FROM items WHERE price [2] 100;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' for price comparison
Using wrong column names
✗ Incorrect
Select the column name and filter rows where price > 100.
5fill in blank
hardFill all three blanks to insert a new user with id 5, name 'Alice', and email 'alice@example.com' into 'users'.
MySQL
INSERT INTO users ([1], [2], [3]) VALUES (5, 'Alice', 'alice@example.com');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong column names like 'username' instead of 'name'
Mismatching columns and values order
✗ Incorrect
The columns must match the values: id, name, and email.