Page 144 - SQL
P. 144

-- cannot insert
                 -- the value NULL into column 'MyCol1', table 'MyTable';
                 -- column does not allow nulls. INSERT fails.


        Updating fields to NULL


        Setting a field to NULL works exactly like with any other value:


         UPDATE Employees
         SET ManagerId = NULL
         WHERE Id = 4


        Inserting rows with NULL fields


        For example inserting an employee with no phone number and no manager into the Employees
        example table:


         INSERT INTO Employees
             (Id, FName, LName, PhoneNumber, ManagerId, DepartmentId, Salary, HireDate)
         VALUES
             (5, 'Jane', 'Doe', NULL, NULL, 2, 800, '2016-07-22') ;


        Read NULL online: https://riptutorial.com/sql/topic/3421/null




















































        https://riptutorial.com/                                                                             126
   139   140   141   142   143   144   145   146   147   148   149