sql not null constraint

SQL Advance

homeBack

Next

SQL NOT NULL Constraint

  • 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 “S.no” column and the “Name2” column to not accept NULL values: 

    CREATE TABLE emp
    (
    S.no int NOT NULL,
    Name2 varchar(255) NOT NULL,
    Name1 varchar(255),
    City varchar(255)
    )

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s