Complete the code to select all columns from the table named employees.
SELECT [1] FROM employees;The asterisk (*) selects all columns from the table.
Complete the code to filter rows where the salary is greater than 50000.
SELECT * FROM employees WHERE salary [1] 50000;
The greater than symbol (>) filters salaries above 50000.
Fix the error in the query to count the number of employees.
SELECT COUNT([1]) FROM employees;Using COUNT(*) counts all rows regardless of column values.
Fill both blanks to create a dictionary of employee names and their salaries where salary is above 60000.
SELECT jsonb_object_agg([1], [2]) FROM employees WHERE salary > 60000;
jsonb_object_agg(key, value) creates a JSON object with keys and values. Here, names are keys and salaries are values.
Fill all three blanks to create a JSON object with employee names as keys, their salaries as values, but only include those in the 'Sales' department.
SELECT jsonb_object_agg([1], [2]) FROM employees WHERE department = '[3]';
This query creates a JSON object mapping employee names to salaries, filtered to only those in the Sales department.