Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to limit data in MYSQL

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 513
    Comment on it

    The LIMIT clause in MySQL helps to get multi pages results or pagination through SQL Databases. This LIMIT clause is very useful on large tables its because returning the large numbers of records through MYSQL will be difficult to read and analyze..


    If we wish to get all the records from Database from numbered 1 - 50  from a table called "abcd". The query will be used for this will be-->

    $sql = "SELECT * FROM abcd LIMIT 50";

    When you run this query written above , you will get the results from 1 to 50 records.

    We can use the another query to get the number of results after the selected number of records.The SQL query will get the results "return only 10 records, start on record 50 (OFFSET 50)":

    $sql = "SELECT * FROM Orders LIMIT 10 OFFSET 50";

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: