How to use the limit clause in sql?
Example:
-- Trying to retrieve a limited number of customers without using LIMIT
SELECT name FROM customers;
Solution:
-- Correctly retrieving a limited number of customers using the LIMIT clause
SELECT name FROM customers LIMIT 5;
The LIMIT clause in SQL restricts the number of rows returned by a query. In this example, we limit the result to the first 5 customers.