limit clause in SQL

SQL LIMIT is an optional clause of the SELECT statement that constrains the number of rows returned by the query.
The following illustrates the syntax of the LIMIT clause,
```
SELECT select_list 
FROM table_name
ORDER BY sort_expression
LIMIT row_count
```
The statement returns row_count rows generated by the query. If row_count is zero, the query returns an empty set. In case row_count is NULL, the query returns the same result set as it does not have the LIMIT clause.
In case you want to skip a number of rows before returning the row_count rows, you use OFFSET clause placed after the LIMIT clause as the following statement:
```
SELECT select_list
FROM table_name
LIMIT row_count OFFSET row_to_skip;
```
The statement first skips row_to_skip rows before returning row_count rows generated by the query. If row_to_skip is zero, the statement will work like it doesn’t have the OFFSET clause.
Because a table may store rows in an unspecified order, when you use the LIMIT clause, you should always use the ORDER BY clause to control the row order. If you don’t use the ORDER BY clause, you may get a result set with the unspecified order of rows.
```
SELECT
	film_id,
	title,
	release_year
FROM
	film
ORDER BY
	film_id
LIMIT 4 OFFSET 3;
```