Select * from table_name
LIMIT number;
Select * from student_table
LIMIT 3;
The OFF SET value is also most often used together with the LIMIT keyword. The OFF SET value allows us to specify which row to start from retrieving data
Let’s suppose that we want to get a limited number of members starting from the middle of the rows, we can use the LIMIT keyword together with the offset value to achieve that. The script shown below gets data starting the fourth row and limits the results to 3.
Select * from student_table
LIMIT 3,3 ;
Let’s suppose that we are developing the application that runs on top of myflixdb. Our system designer have asked us to limit the number of records displayed on a page to say 20 records per page to counter slow load times. How do we go about implementing the system that meets such user requirements? The LIMIT keyword comes in handy in such situations. We would be able to limit the results returned from a query to 20 records only per page.
We can restrict the number of records to be retrieved from the result set by using the LIMIT clause in MySQL. This clause also helps us to specify the offset from where the row counting should start while retrieval and specify the row count which tells how many rows are to be retrieved.