What is the SQL DEFAULT CONSTRAINT?
The SQL DEFAULT CONSTRAINT is used to set default value for specific column.
SQL DEFAULT value on CREATE TABLE:
Assume that you want to create table customer. One of the column on your customer table is "type_of_membership" that defines if customer is a regular memebr or premier memebr. If it is not specified than by default you want to assign that customer as a regular customer. You can use SQL DEFAULT CONSTRAINT in this case on type_of_membership column.
Use following syntax of SQL DEFAULT value on CREATE TABLE SQL for MySQL, Oracle and SQL Server:
CREATE TABLE customer ( id INT NOT NULL, address VARCHAR(50) NOT NULL, type_of_customer VARCHAR(20) NOT NULL DEFAULT 'regular' );