SQL Default Constraints

Advertisements

Prev Tutorial Next Tutorial

SQL Default Constraints

Default Constraints is used to insert a default value into a column. The default value will be added to all new records, if no other value is specified.

My SQL or SQL Server or Oracle or MS Access

	
create table Employee
(
e_id number(3) NOT NULL,,
e_name varchar(15),
sal number(5),
City varchar(255) DEFAULT 'Delhi',
);

In above syntax in city column by default value for city of every employee is delhi.

SQL DEFAULT Constraint on Alter Table

My SQL

	
ALTER TABLE Employee
ALTER City SET DEFAULT 'delhi'

SQL Server or MS Access

	
ALTER TABLE Employee
ALTER COLUMN City SET DEFAULT 'delhi'

Oracle

	
ALTER TABLE Employee
ALTER City SET DEFAULT 'delhi'

Drop Default Constraints

My SQL

	
ALTER TABLE Employee
ALTER City DROP DEFAULT

SQL Server or Oracle or MS Access

	
ALTER TABLE Employee
ALTER COLUMN City DROP DEFAULT

Prev Tutorial Next Tutorial

Advertisements

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

Download Projects

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements