0
0
MySQLquery~10 mins

INNER 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 columns from two tables using INNER JOIN.

MySQL
SELECT * FROM employees [1] departments ON employees.department_id = departments.id;
Drag options to blanks, or click blank then click option'
AFULL JOIN
BLEFT JOIN
CRIGHT JOIN
DINNER JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using LEFT JOIN or RIGHT JOIN instead of INNER JOIN changes the result set.
Forgetting the ON clause after the join keyword.
2fill in blank
medium

Complete the code to join tables employees and salaries on employee_id.

MySQL
SELECT employees.name, salaries.amount FROM employees [1] salaries ON employees.id = salaries.employee_id;
Drag options to blanks, or click blank then click option'
AINNER JOIN
BLEFT JOIN
CRIGHT JOIN
DFULL JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong join type.
Joining on wrong columns.
3fill in blank
hard

Fix the error in the INNER JOIN syntax to correctly join customers and orders on customer_id.

MySQL
SELECT customers.name, orders.order_date FROM customers [1] orders ON customers.id = orders.customer_id;
Drag options to blanks, or click blank then click option'
AINNER JOIN ON
BINNER JOIN
CJOIN ON
DINNER JOIN WHERE
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting ON keyword.
Using WHERE instead of ON for join condition.
4fill in blank
hard

Fill both blanks to join products and categories on category_id and select product name and category name.

MySQL
SELECT products.name, categories.[1] FROM products [2] categories ON products.category_id = categories.id;
Drag options to blanks, or click blank then click option'
Aname
BINNER JOIN
Ccategory_name
DLEFT JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting wrong column from categories.
Using LEFT JOIN instead of INNER JOIN.
5fill in blank
hard

Fill all three blanks to join orders, customers, and payments to select order id, customer name, and payment amount.

MySQL
SELECT orders.id, customers.[1], payments.[2] FROM orders [3] customers ON orders.customer_id = customers.id INNER JOIN payments ON orders.id = payments.order_id;
Drag options to blanks, or click blank then click option'
Aname
Bamount
CINNER JOIN
DLEFT JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using LEFT JOIN instead of INNER JOIN.
Selecting wrong column names.