TechnoLearnAcademy

TECHNOLEARN

SQL ALTER STATEMENT ADD DEFAULT CONSTRAINT

The ALTER TABLE Statement is used to add a default constraint to an existing table.

Syntax:      

                  ALTER TABLE  table_name                                                                                                                                                                ADD CONSTRAINT ConstraintName                                                                                                                                                DEFAULT value for (column_name);

Example:

   Objective: In this example, we will add default constraint to an existing table emp
                   ALTER TABLE Tbl_Emp
                   ADD CONSTRAINT Default_const
                   DEFAULT ‘Texas’ for (Location)
Scroll to Top