Complete the SQL query to select unique values including NULLs from the column 'category'.
SELECT DISTINCT [1] FROM products;The DISTINCT keyword selects unique values including NULLs from the specified column. Using 'category' returns unique categories including NULL.
Complete the SQL query to group rows by the 'status' column, including NULL values as a group.
SELECT status, COUNT(*) FROM orders GROUP BY [1];GROUP BY groups rows by the column values including NULLs. Using 'status' groups all rows by their status values, including NULL as its own group.
Fix the error in the ORDER BY clause to sort by 'price' including NULL values last.
SELECT * FROM products ORDER BY price [1];To sort prices ascending with NULL values at the end, use 'ASC NULLS LAST'. This ensures NULLs appear after all numbers.
Fill both blanks to select unique 'department' values and order them with NULLs first.
SELECT DISTINCT [1] FROM employees ORDER BY [2] NULLS FIRST;
We select DISTINCT 'department' and order by 'department' with NULLs first to see NULL departments at the top.
Fill all three blanks to group by 'region', count orders, and order groups with NULL regions last.
SELECT [1], COUNT(*) FROM sales GROUP BY [2] ORDER BY [3] NULLS LAST;
We select and group by 'region' to count orders per region, then order by 'region' placing NULLs last.