0
0
MySQLquery~10 mins

WHERE clause filtering in MySQL - Interactive Code Practice

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

Complete the code to select all records where the age is greater than 30.

MySQL
SELECT * FROM employees WHERE age [1] 30;
Drag options to blanks, or click blank then click option'
A<=
B<
C=
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of '>' will only select rows where age is exactly 30.
Using '<' will select ages less than 30, which is incorrect.
2fill in blank
medium

Complete the code to select employees whose department is 'Sales'.

MySQL
SELECT * FROM employees WHERE department [1] 'Sales';
Drag options to blanks, or click blank then click option'
A=
B!=
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' will select employees not in Sales, which is the opposite.
Using '>' or '<' does not make sense for string comparison here.
3fill in blank
hard

Fix the error in the code to select employees hired before 2020.

MySQL
SELECT * FROM employees WHERE hire_date [1] '2020-01-01';
Drag options to blanks, or click blank then click option'
A>
B<
C>=
D=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' will select employees hired after 2020, which is incorrect.
Using '=' will only select employees hired exactly on 2020-01-01.
4fill in blank
hard

Fill both blanks to select employees with salary greater than 50000 and department 'HR'.

MySQL
SELECT * FROM employees WHERE salary [1] 50000 [2] department = 'HR';
Drag options to blanks, or click blank then click option'
A>
B<
CAND
DOR
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' for salary will select lower salaries, which is wrong.
Using OR will select employees who meet either condition, not both.
5fill in blank
hard

Fill all three blanks to select employees where age is less than 40, department is 'IT', and salary is at least 60000.

MySQL
SELECT * FROM employees WHERE age [1] 40 [2] department [3] 'IT' AND salary >= 60000;
Drag options to blanks, or click blank then click option'
A>
B<
C=
DAND
Attempts:
3 left
💡 Hint
Common Mistakes
Using > for age will select older employees, which is wrong.
Using OR instead of AND will select employees meeting any condition, not all.
Using != instead of = will select employees not in IT.