DEFAULT requirement is utilized to embed default value into a segment on a table and on the off chance that no any value is put away in wherever of a section, at that point default value will be included into it.
How to use DEFAULT with example?
CREATE TABLE EMployees (E_Id int NOT NULL,E_Name varchar(25) NOT NULL, Contact number(10),Address varchar(50), City varchar(20) DEFAULT 'Gwaloir');
We can also achieve DEFAULT value property by using GETDATE() function:
CREATE TABLE Employees (E_Id int NOT NULL,E_name varchar(50), E_Join_Date date DEFAULT GETDATE());
USE of ALTER to ADD DEFAULT constraint when table is already created:
There is different way to add DEFAULT constraint in different database language:
How to DROP DEFAULT constraint from a table?
ALTER TABLE Employees ALTER COLUMN City DROP DEFAULT;
In this article we have realized what DEFAULT limitation is, how to utilize it with example and how we can change and drop DEFAULT on a table? In the event that you have any uncertainty/question, don’t hesitate to ask in remark segment.