Default Constraint | DEFAULT Constraint in SQL - sql - sql tutorial - learn sql
- The DEFAULT constraint is used to provide a default value for a column.
- The default value will be added to all new records IF no other value is specified.
- The DEFAULT constraint provides a default value to a column when the INSERT INTO does not provide a specific value.
- For example, if we create a table as below:
- and execute the following SQL statement
- The table will look like the following
- Even though we didn't specify a value for the "Score" column in the INSERT INTO statement, it does get assigned the default value of 80 since we had already set 80 as the default value for this column.