0
0
DBMS Theoryknowledge~10 mins

Joins in SQL in DBMS Theory - 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 an INNER JOIN.

DBMS Theory
SELECT * FROM employees [1] departments ON employees.department_id = departments.id;
Drag options to blanks, or click blank then click option'
AINNER JOIN
BJOIN
CLEFT JOIN
DRIGHT JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using LEFT JOIN instead of INNER JOIN returns unmatched rows from the left table.
Using JOIN alone may work but is less explicit than INNER JOIN.
2fill in blank
medium

Complete the code to select all employees and their departments, including employees without a department.

DBMS Theory
SELECT employees.name, departments.name FROM employees [1] departments ON employees.department_id = departments.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 INNER JOIN excludes employees without departments.
Using RIGHT JOIN would keep all departments, not employees.
3fill in blank
hard

Fix the error in the join type to include all records from both tables.

DBMS Theory
SELECT * FROM orders [1] customers ON orders.customer_id = customers.id;
Drag options to blanks, or click blank then click option'
AINNER JOIN
BLEFT JOIN
CFULL OUTER JOIN
DCROSS JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using INNER JOIN excludes unmatched rows.
Using CROSS JOIN produces a Cartesian product, not a join on keys.
4fill in blank
hard

Fill both blanks to select all customers and their orders, including customers without orders.

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

Fill all three blanks to create a query that selects product names and supplier names, including products without suppliers.

DBMS Theory
SELECT products.name, suppliers.name FROM products [1] suppliers ON products.supplier_id [2] suppliers.id WHERE suppliers.country [3] 'USA';
Drag options to blanks, or click blank then click option'
ALEFT JOIN
B=
DINNER JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using INNER JOIN excludes products without suppliers.
Using != in ON or WHERE clauses breaks the intended logic.