Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • MySQL: selecting rows where a column is null

    • 0
    • 1
    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 587
    Comment on it

    In MySQL, we can select rows where a column is null by using IS NULL operator.

    We have a table "employee" as below:

       

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

    Use the IS NULL operator

    The below statement selects all employee where "country" is null:

       

        SELECT * FROM employee
        WHERE country is null;

    Result

      

      id first_name salary country
      .......................................................
      2  Chris      20000  NULL
      3  Max        30000  NULL

    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: