Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • SQL Null Meaning

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 161
    Comment on it

    What is Null ? Null means no data or missing data or we don't have a data in a table . If you think Null means 0 ( zero ) than you are wrong .
    There can be two condition for Null
    1) when SQL is Null
    2) when SQL is not Null
    If in a table you write " Not Null " it means it is mandatory to enter a data in that column and if you don't write " Not Null " than it is not mandatory to fill that column . That means that field have automatically null value .

    Example :

        create table student ( stu_id int not null , stu_name varchar ( 20 ) ) ; // Here id is mandatory
    
        create table student ( stu_id int , stu_name varchar ( 20 ) ) ; // Here id is not mandatory
    
    1) When SQL is Null :

              Employee_name            Employee_Age          Employee _Salary
                Mukesh                  23                         
                Ayush                   24                           200000
                Ishan                   20                          
                Pranav                  35                           700000
                Abhishek                26                         
                Ravi                    25                           300000
                David                   40                           800000
    

    Query to select Null Fields :

       select  Employee_name , Employee_Age , Employee _Salary from student where Employee_Salary is null       ;
    

    Output :

             Employee_name            Employee_Age          Employee _Salary
                  Mukesh                  23     
                  Ishan                   20  
                  Abhishek                26      
    

    2) When SQL is Not Null :
    Output :

               Employee_name            Employee_Age          Employee _Salary
                    Ayush                   24                       200000
                    Pranav                  35                       700000
                    Ravi                    25                       300000
                    David                   40                       800000
    

 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: