0
0
SQLquery~10 mins

Second Normal Form (2NF) in SQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the SQL query to select all columns from the table named 'Orders'.

SQL
SELECT [1] FROM Orders;
Drag options to blanks, or click blank then click option'
A*
BALL
CEVERYTHING
DCOLUMNS
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ALL' instead of '*' to select all columns.
Using 'COLUMNS' or 'EVERYTHING' which are not valid SQL keywords.
2fill in blank
medium

Complete the SQL query to find orders where the quantity is greater than 10.

SQL
SELECT * FROM Orders WHERE quantity [1] 10;
Drag options to blanks, or click blank then click option'
A=
B<
C<=
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' which checks for equality, not greater than.
Using '<' or '<=' which check for less than conditions.
3fill in blank
hard

Fix the error in the SQL query to select distinct customer IDs from Orders.

SQL
SELECT [1] customer_id FROM Orders;
Drag options to blanks, or click blank then click option'
ADISTINCT
BUNIQUE
CSINGLE
DONLY
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'UNIQUE' which is not valid in SELECT clauses for distinct values.
Using 'SINGLE' or 'ONLY' which are not SQL keywords.
4fill in blank
hard

Fill both blanks to create a SQL query that groups orders by customer_id and counts the number of orders.

SQL
SELECT customer_id, COUNT([1]) AS order_count FROM Orders GROUP BY [2];
Drag options to blanks, or click blank then click option'
A*
Border_id
Ccustomer_id
Dquantity
Attempts:
3 left
💡 Hint
Common Mistakes
Counting a specific column that might have NULLs instead of all rows.
Grouping by a column other than customer_id.
5fill in blank
hard

Fill all three blanks to write a SQL query that selects product_id, sums quantity sold, and groups by product_id having total quantity greater than 100.

SQL
SELECT [1], SUM([2]) AS total_quantity FROM Sales GROUP BY [3] HAVING total_quantity > 100;
Drag options to blanks, or click blank then click option'
Aproduct_id
Bquantity
Dorder_id
Attempts:
3 left
💡 Hint
Common Mistakes
Grouping by order_id instead of product_id.
Summing a wrong column or not grouping properly.