What do you think of this post?
  • Awesome 
  • Interesting 
  • Useful 

-- Download SQL NOT NULL Constraint as PDF --


[amazon-deals height=”280″ width=”336″]1bb4e641-5c29-46e1-9302-d1032e9caad5[/amazon-deals] 

The NOT NULL constraint enforces a column to NOT accept NULL values.

The NOT NULL constraint enforces a field to always contain a value. This means that you cannot insert a new record, or update a record without adding a value to this field.

The following SQL enforces the “P_Id” column and the “LastName” column to not accept NULL values:

CREATE TABLE Persons
(
P_Id int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)
What do you think of this post?
  • Awesome 
  • Interesting 
  • Useful 

Leave a Reply

Your email address will not be published. Required fields are marked *


*