By 25/02/2016 1 Comments

What Is DEFAULT Constraint In SQL?

  • SQL DEFAULT constraint inserts a default value into a table column if no other value is inserted explicitly.

OR

  • If you do not insert values explicitly into a table columns the default values will be inserted in all these columns through a DEFAULT constraint.

Example: MySQL, SQL Server, Oracle, MS Access

CREATE TABLE country
(
country_id BIGINT(11) PRIMARY KEY,
country_name VARCHAR(200) DEFAULT 'pakistan',
country_location VARCHAR(200) NOT NULL,
country_zipcode INT(60),
UNIQUE (country_zipcode)
);


Note:

  • In above example a DEFAULT constraint is added on country_name and inserts default value ‘pakistan’ in it.






Posted in: Sql

Leave your valuable Comment

Have a natural attraction for women cosmetics and replica watches uk clothes, no
more than two for men the most attractive one, is to make their own driving experience, happy and can serve as the facade of the car, another is to highlight the taste edify sentiment rolex replica watch. The replica rolex is undoubtedly the most fashionable accessories, wear a suit to attend the activities, but also get a decent match on the replica watches .