SELECT with FETCH and ORDER BY clauses

In this exercise we'll query the customers table and order the results by company_name in ascending order, while limiting the rows returned to 7.

SELECT customer_id,
company_name,
contact_name,
contact_title
FROM customers
ORDER BY company_name ASC FETCH NEXT 7 ROWS ONLY;
Run in terminal

This query should return 7 rows.

SELECT with FETCH, OFFSET and ORDER BY clauses

In this exercise we'll query the customers table and order the results by company_name in ascending order, while limiting the rows returned to the 7 that come after the first 2.

SELECT customer_id,
company_name,
contact_name,
contact_title
FROM customers
ORDER BY company_name ASC
OFFSET 2 FETCH NEXT 7 ROWS ONLY;
Run in terminal

This query should return 7 rows.