0
0
MySQLquery~10 mins

LEFT JOIN 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 customers and their orders using a LEFT JOIN.

MySQL
SELECT customers.name, orders.order_id FROM customers [1] orders ON customers.id = orders.customer_id;
Drag options to blanks, or click blank then click option'
ALEFT JOIN
BINNER JOIN
CRIGHT JOIN
DFULL JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using INNER JOIN will exclude customers without orders.
RIGHT JOIN returns all orders even if no customer matches.
2fill in blank
medium

Complete the code to get all employees and their department names, including employees without a department.

MySQL
SELECT employees.name, departments.name FROM employees [1] departments ON employees.dept_id = departments.id;
Drag options to blanks, or click blank then click option'
ARIGHT JOIN
BINNER JOIN
CCROSS JOIN
DLEFT JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using INNER JOIN excludes employees without departments.
RIGHT JOIN would include all departments, not all employees.
3fill in blank
hard

Fix the error in the LEFT JOIN query to include all products and their categories.

MySQL
SELECT products.name, categories.name FROM products [1] categories ON products.category_id = categories.id;
Drag options to blanks, or click blank then click option'
ARIGHT JOIN
BINNER JOIN
CLEFT JOIN
DFULL JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using INNER JOIN excludes products without categories.
FULL JOIN is not supported in MySQL.
4fill in blank
hard

Fill both blanks to select all students and their grades, including students without grades.

MySQL
SELECT students.name, grades.score FROM students [1] grades ON students.id [2] grades.student_id;
Drag options to blanks, or click blank then click option'
ALEFT JOIN
B=
C!=
DRIGHT JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' in ON condition breaks the join logic.
RIGHT JOIN would keep all grades, not all students.
5fill in blank
hard

Fill all three blanks to select all orders, their customers, and order dates, including orders without customers.

MySQL
SELECT orders.id, [1], orders.order_date FROM orders [2] customers ON orders.customer_id [3] customers.id;
Drag options to blanks, or click blank then click option'
Acustomers.name
BLEFT JOIN
C=
DINNER JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using INNER JOIN excludes orders without customers.
Using '!=' in ON condition breaks the join.