Complete the SQL query to select all columns from the table named 'employees'.
SELECT [1] FROM employees;In SQL, * means select all columns from the table.
Complete the SQL query to get only the distinct department names from the 'departments' table.
SELECT [1] department_name FROM departments;The keyword DISTINCT returns unique values in SQL.
Fix the error in the SQL query to count the number of employees in each department.
SELECT department_id, COUNT([1]) FROM employees GROUP BY department_id;Using COUNT(*) counts all rows per group, which is the correct way to count employees.
Fill both blanks to create a query that finds employees with salary greater than 50000.
SELECT * FROM employees WHERE salary [1] [2];
The condition salary > 50000 filters employees earning more than 50000.
Fill all three blanks to create a query that lists employee names and their department names by joining 'employees' and 'departments' tables.
SELECT e.name AS employee_name, d.name AS department_name FROM employees e [1] departments d ON e.[2] = d.[3];
Use JOIN to combine tables on matching department_id columns.