Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • What is the use of LIMIT Clause in MySQL?

    • 0
    • 1
    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 373
    Comment on it

    In MySQL, the LIMIT Clause is used to return the specified number of records means by using LIMIT we can specify how many records we want to return from a table..

    The LIMIT Clause is useful when, we want to select some records from a table which has thousands of records.

    LIMIT Clause Syntax

    SELECT column_name(s)
    FROM table_name
    LIMIT number;
    

    We have a table "employee" as below:

        employee
    
        id  first_name               salary       country
        .......................................................
        1   John                     10000         Canada
        2   Chris                    20000         California
        3   Max                      30000         London
        4   Jenny                    25000         Canada
    

    LIMIT Clause Example

    The below statement returns the 2 records of the employee table:

    SELECT *
    FROM employee
    LIMIT 2;
    

    Result

        id  first_name               salary       country
        .......................................................
        1   John                     10000         Canada
        2   Chris                    20000         California
    

    Hope this will help you :)

 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: