Complete the code to select only the first 5 rows from the table.
SELECT * FROM employees [1] 5;
The LIMIT clause restricts the number of rows returned by the query. Here, it limits the output to 5 rows.
Complete the code to select 3 rows starting from the 6th row.
SELECT * FROM products [1] 3 OFFSET 5;
The LIMIT clause specifies how many rows to return, and OFFSET skips the first rows. Here, it returns 3 rows starting after skipping 5.
Fix the error in the query to correctly limit results to 10 rows.
SELECT name, age FROM users [1] 10 OFFSET 0;
The LIMIT clause is used to restrict the number of rows returned. OFFSET 0 means start from the first row.
Fill both blanks to select 4 rows starting from the 3rd row.
SELECT * FROM orders [1] 4 [2] 2;
LIMIT sets how many rows to return, and OFFSET sets how many rows to skip before starting.
Fill all three blanks to select the top 5 employees ordered by salary descending, skipping the first 10.
SELECT * FROM employees [1] salary DESC [2] 5 [3] 10;
ORDER BY sorts the rows by salary descending. LIMIT restricts to 5 rows, and OFFSET skips the first 10 rows.