Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Use of SELECT statement in MySQL.

    • 0
    • 1
    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 338
    Comment on it

    In MySQL, The SELECT statement is used to select data from a table.

    SELECT Syntax

    SELECT column_name,column_name
    FROM table_name;
    

    and to select all records

    SELECT * FROM table_name;
    

    We have a table "employee" as below:

        employee
        id  first_name            last_name       salary
        .......................................................
        1   John                     Simp         10000
        2   Chris                    Hely         25000
        3   Jenny                    Mill         35000
    

    SELECT Column Example

    The below statement selects the "first_name" and "salary" columns from the "employee" table:

    SELECT first_name,salary FROM employee;
    

    Result:

        first_name            salary
        .............................
        John                  10000
        Chris                 25000
        Jenny                 35000
    

    SELECT * Example

    The below query selects all the columns from the "employee" table:

    SELECT * FROM employee;
    

    Result:

        id  first_name            last_name       salary
        .......................................................
        1   John                     Simp         10000
        2   Chris                    Hely         25000
        3   Jenny                    Mill         35000
    

    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: