It is common in web application there is the return of a very large volume of records when performing a query tables that store large amounts of data need a parameter must stop for a simple query does not lock any application.
For queries with a very large volume of returns are optimized LIMIT command is used, it is responsible for determining exactly which records will appear through an initial and final number.
To use the LIMIT command just add it in the query syntax as shown below:
SELECT [Fields] FROM [Table] LIMIT [X,X]
The parameters to be specified for the command LIMIT points indicate that the records should be displayed and how far they will appear. We go to a practical example.
SELECT Cod_prod, Name
Using the above command will be shown only eight records in the query starting with the first record (index 0). If you want the query to start at another location just indicate it in the first parameter.
The LIMIT command is used in various situations, among the key can highlight pagers. They are widely used by web applications and help a lot in order to optimize the speed of them.
Want to know more about MySQL and how it can offer numerous advantages for projects in PHP? Then visit our page on PHP and MySQL and discover several advantages over these two important technologies available in the market.