Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Use of OFFSET in limiting data selections from MySQL

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 108
    Comment on it

    On selecting the data from MySQL if we are required to limit the data but also it is needed to start from some offset only not from the first record, then there we can add OFFSET in the clause of the query.

    Lets take an example where we required 10 records from offset 10 i.e.,from 11th record

    $sql = "SELECT * FROM EMP LIMIT 10 OFFSET 10";
    

    In the above the limit is of 10 and the offset is set to 10th record i.e., it starts from 11th one.

    Note : In shorthand method we can write it as :

    $sql = "SELECT * FROM EMP LIMIT 10, 10";
    

 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: