Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • What is NOT NULL Constraint in MySQL?

    • 0
    • 1
    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 299
    Comment on it

    In MySQL, the NOT NULL constraint is used to restrict a column to NOT accept NULL values.

    The NOT NULL constraint allows a column to always contains a value which means you cant not insert/update a record in a table without passing value for that column on which you have applied the NOT NULL constraint.

    The below statement doesn't allow to "id" column and "first_name" column to accept NULL values:

    Example

    CREATE TABLE emplyee
    (
    id int NOT NULL,
    first_name varchar(45) NOT NULL,
    last_name varchar(45),
    country varchar(45)
    );
    

    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: