0
0
SQLquery~10 mins

INNER JOIN with table aliases in SQL - 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 the joined tables.

SQL
SELECT * 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 LEFT JOIN instead of INNER JOIN returns unmatched rows from the left table.
Using FULL JOIN returns all rows from both tables, not just matches.
2fill in blank
medium

Complete the code to assign aliases to tables and select employee names and department names.

SQL
SELECT employees.name, d.name FROM employees [1] departments d ON employees.department_id = d.id;
Drag options to blanks, or click blank then click option'
ALEFT JOIN
BRIGHT JOIN
CJOIN
DINNER JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using LEFT JOIN changes the result to include unmatched left rows.
Using RIGHT JOIN changes the result to include unmatched right rows.
3fill in blank
hard

Fix the error in the code by completing the alias for the employees table.

SQL
SELECT e.name, d.name FROM employees [1] departments d ON e.department_id = d.id;
Drag options to blanks, or click blank then click option'
AAS e INNER JOIN
BINNER JOIN
CINNER JOIN AS e
De INNER JOIN
Attempts:
3 left
💡 Hint
Common Mistakes
Placing the alias after INNER JOIN causes syntax errors.
Omitting AS keyword can cause confusion but is allowed in some SQL dialects.
4fill in blank
hard

Fill both blanks to correctly alias tables and join them on matching department IDs.

SQL
SELECT [1].name, [2].name FROM employees AS e INNER JOIN departments AS d ON e.department_id = d.id;
Drag options to blanks, or click blank then click option'
Ae
Bd
Cemployees
Ddepartments
Attempts:
3 left
💡 Hint
Common Mistakes
Using full table names instead of aliases when aliases are defined.
Mixing aliases and full table names inconsistently.
5fill in blank
hard

Fill all three blanks to select employee name, department name, and filter by department location.

SQL
SELECT [1].name, [2].name FROM employees AS e INNER JOIN departments AS d ON e.department_id = d.id WHERE [3].location = 'New York';
Drag options to blanks, or click blank then click option'
Ae
Bd
Cdepartments
Demployees
Attempts:
3 left
💡 Hint
Common Mistakes
Using full table names instead of aliases in WHERE clause.
Filtering on the wrong table alias.