Complete the code to select all columns from the employees table.
SELECT [1] FROM employees;The asterisk (*) selects all columns from the table.
Complete the code to filter employees with salary greater than 50000.
SELECT * FROM employees WHERE salary [1] 50000;
The '>' operator filters rows where salary is greater than 50000.
Fix the error in the query to count employees in each department.
SELECT department, COUNT([1]) FROM employees GROUP BY department;Using COUNT(*) counts all rows per department, which is the correct way to count employees.
Fill both blanks to create an index on the salary column to improve query speed.
CREATE INDEX idx_salary ON employees USING [1]([2]);
BTREE is the default and most common index type in PostgreSQL. Indexing the salary column helps speed up queries filtering by salary.
Fill all three blanks to write a query that selects employee names and orders them by salary descending.
SELECT [1], salary FROM employees ORDER BY [2] [3];
Select the 'name' column, order by 'salary' in descending order (DESC) to see highest salaries first.