alternative for LIMIT sql 1

alternative for LIMIT sql

SELECT
    product_name,
    list_price
FROM
    production.products
ORDER BY
    list_price DESC,
    product_name 
OFFSET 0 ROWS 
FETCH FIRST 10 ROWS ONLY;
Code language: SQL (Structured Query Language) (sql)

Here is what the above code is Doing:
1. The SELECT statement is used to select data from a database.
2. The FROM clause is used to select data from a database table.
3. The ORDER BY keyword is used to sort the result-set in ascending or descending order.
4. The OFFSET clause is used to skip a specified number of rows in the result-set before starting to return rows.
5. The FETCH clause is used to limit the number of rows returned in the result-set.
6. The FIRST keyword is used to specify the number of rows to be returned.
7. The ROWS keyword is used to specify the number of rows to be returned.
8. The ONLY keyword is used to specify that only rows should be returned.

Similar Posts