The LIMIT statement is an optional clause of the SELECT statement that limits the number of rows returned by the query.
SELECT select_list FROM table_name ORDER BY sort_expression LIMIT row_num ;
If you want to skip a few lines before returning row_num rows, use the OFFSET clause after the LIMIT clause as in the following expression.
SELECT select_list FROM table_name LIMIT row_num OFFSET skip_line ; SELECT film_id, title, release_year FROM film ORDER BY film_id LIMIT 5 ; SELECT film_id, title, release_year FROM film ORDER BY film_id LIMIT 5 OFFSET 4 ;
The query skips 4 lines and returns 5 lines from line 5 in the output.
SELECT film_id, title,rental_rate FROM film ORDER BY rental_rate DESC LIMIT 10 ;