TechnoLearnAcademy

TECHNOLEARN

DEFAULT CONSTRAINT

A DEFAULT constraint is a database concept used to specify a default value for a column when a new row is inserted into a table and no value is provided for that column.

Example:

   Objective: In this example, we will assign a default value to the department column.
                      CREATE TABLE TBL_EMP(
                                                              Ecode varchar(20) Primary key,
                                                              Name varchar(20),
                                                              Emailaddress varchar(20),
                                                              Department varchar(20) DEFAULT ‘NY’,
                                                              Salary int
                                                                              );
Scroll to Top