0
0
SQLquery~10 mins

Why filtering is essential in SQL - Test Your Understanding

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

Complete the code to select only employees from the 'Sales' department.

SQL
SELECT * FROM employees WHERE department = [1];
Drag options to blanks, or click blank then click option'
A'HR'
B'Finance'
C'Marketing'
D'Sales'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to use quotes around the department name.
Using the wrong department name.
2fill in blank
medium

Complete the code to find products with a price greater than 100.

SQL
SELECT product_name FROM products WHERE price [1] 100;
Drag options to blanks, or click blank then click option'
A<
B>
C=
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using < instead of >.
Using = which only finds prices exactly 100.
3fill in blank
hard

Fix the error in the code to select customers from 'USA'.

SQL
SELECT * FROM customers WHERE country = [1];
Drag options to blanks, or click blank then click option'
A'USA'
BUSA
C"USA"
D‘USA’
Attempts:
3 left
💡 Hint
Common Mistakes
Using no quotes or double quotes around string values.
Using fancy quotes like ‘ or ’ which are invalid.
4fill in blank
hard

Fill both blanks to select orders with quantity less than 10 and status 'pending'.

SQL
SELECT * FROM orders WHERE quantity [1] 10 AND status = [2];
Drag options to blanks, or click blank then click option'
A<
B>
C'pending'
D'completed'
Attempts:
3 left
💡 Hint
Common Mistakes
Using > instead of < for quantity.
Forgetting quotes around 'pending'.
5fill in blank
hard

Fill all three blanks to select employees whose age is greater than 30 and department is 'HR'.

SQL
SELECT name, age, department FROM employees WHERE age [1] 30 AND department = [2] ORDER BY [3];
Drag options to blanks, or click blank then click option'
A<
B>
C'HR'
Dage
Attempts:
3 left
💡 Hint
Common Mistakes
Using < instead of > for age.
Forgetting quotes around 'HR'.
Ordering by a wrong column.