What is a default constraint? SQL Server Interview Question
SQL Server Interview Question: What is a default constraint?
The DEFAULT constraint is used to insert a default value into a column.
The default value will be added to all new records, if no other value is specified.
CREATE TABLE Employee
(
E_Id int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255) DEFAULT 'Delhi'
)
Click here for more than 300 Sql server Interview questionsThe DEFAULT constraint is used to insert a default value into a column.
The default value will be added to all new records, if no other value is specified.
CREATE TABLE Employee
(
E_Id int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255) DEFAULT 'Delhi'
)
Comments