0
0
SQLquery~10 mins

Why advanced joins matter 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 all columns from the employees table.

SQL
SELECT [1] FROM employees;
Drag options to blanks, or click blank then click option'
A*
Ball
Ccolumns
Deverything
Attempts:
3 left
💡 Hint
Common Mistakes
Using words like 'all' or 'columns' instead of *
Leaving the SELECT statement incomplete
2fill in blank
medium

Complete the code to join employees with departments on department_id.

SQL
SELECT employees.name, departments.name FROM employees [1] JOIN departments ON employees.department_id = departments.id;
Drag options to blanks, or click blank then click option'
AFULL
BLEFT
CRIGHT
DINNER
Attempts:
3 left
💡 Hint
Common Mistakes
Using LEFT JOIN when only matching rows are needed
Using FULL JOIN which includes unmatched rows
3fill in blank
hard

Fix the error in the join condition to correctly join orders and customers.

SQL
SELECT orders.id, customers.name FROM orders INNER JOIN customers ON orders.customer_id [1] customers.id;
Drag options to blanks, or click blank then click option'
A=
B==
C!=
D<>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' instead of '='
Using '!=' or '<>' which mean not equal
4fill in blank
hard

Fill both blanks to select employee names and their manager names using a self join.

SQL
SELECT e.name AS employee, m.name AS manager FROM employees e [1] JOIN employees m ON e.[2] = m.id;
Drag options to blanks, or click blank then click option'
ALEFT
BRIGHT
Cmanager_id
Demployee_id
Attempts:
3 left
💡 Hint
Common Mistakes
Using RIGHT JOIN which excludes some employees
Using wrong column like 'employee_id' for the join
5fill in blank
hard

Fill all three blanks to select product names, order quantities, and customer names using multiple joins.

SQL
SELECT p.[1], o.[2], c.[3] FROM orders o INNER JOIN products p ON o.product_id = p.id INNER JOIN customers c ON o.customer_id = c.id;
Drag options to blanks, or click blank then click option'
Aname
Bquantity
Dprice
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting price instead of name for products
Mixing up column names between tables