Complete the code to select all columns from the employees table.
SELECT [1] FROM employees;The asterisk (*) means select all columns from the table.
Complete the code to join the employees table with the departments table on department_id.
SELECT employees.name, departments.name FROM employees [1] departments ON employees.department_id = departments.department_id;The JOIN keyword combines rows from two tables based on a related column.
Fix the error in the JOIN clause to correctly combine employees and departments.
SELECT employees.name, departments.name FROM employees JOIN departments [1] employees.department_id = departments.department_id;The ON keyword specifies the condition for the JOIN to combine related rows.
Fill both blanks to select employee names and their department names using an INNER JOIN.
SELECT employees.name AS [1], departments.name AS [2] FROM employees INNER JOIN departments ON employees.department_id = departments.department_id;
Aliases help rename columns in the output for clarity.
Fill all three blanks to create a query that selects employee names, department names, and filters for departments with 'Sales' in the name.
SELECT employees.name AS [1], departments.name AS [2] FROM employees JOIN departments ON employees.department_id = departments.department_id WHERE departments.name [3] '%Sales%';
The LIKE operator is used to filter text patterns in SQL.