FETCH
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_titleFROM customersORDER 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_titleFROM customersORDER BY company_name ASCOFFSET 2 FETCH NEXT 7 ROWS ONLY;Run in terminal
This query should return 7 rows.