Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to show the execution plan of a SELECT query.
MySQL
EXPLAIN [1] * FROM employees; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using EXPLAIN with DELETE or UPDATE without SELECT
Forgetting to put SELECT after EXPLAIN
✗ Incorrect
The EXPLAIN statement is used with a SELECT query to show how MySQL executes it.
2fill in blank
mediumComplete the code to analyze a query filtering by department.
MySQL
EXPLAIN SELECT * FROM employees WHERE department [1] 'Sales';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using LIKE without wildcards
Using IN with a single value
✗ Incorrect
The '=' operator is used to filter rows where the department exactly matches 'Sales'.
3fill in blank
hardFix the error in the EXPLAIN query by completing the missing keyword.
MySQL
EXPLAIN [1] * FROM employees WHERE salary > 50000;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using EXPLAIN FROM instead of EXPLAIN SELECT
Omitting SELECT keyword
✗ Incorrect
EXPLAIN must be followed by a SELECT statement to analyze the query plan.
4fill in blank
hardFill both blanks to analyze a query that orders employees by hire date.
MySQL
EXPLAIN SELECT * FROM employees ORDER BY [1] [2];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using salary instead of hire_date
Using DESC when ascending order is intended
✗ Incorrect
The query orders employees by their hire date in ascending order.
5fill in blank
hardFill all three blanks to analyze a query that joins employees and departments.
MySQL
EXPLAIN SELECT e.name, d.name FROM employees e [1] departments d ON e.[2] = d.[3];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using JOIN instead of LEFT JOIN
Mixing column names in ON clause
✗ Incorrect
The query uses a LEFT JOIN to combine employees with departments matching on department_id and id.