How to alter table with a default value?

Query By: SOMPONG APHAY

D

Deepa Jha

ALTER TABLE statement In SQL

In SQL, the ALTER TABLE statement is used to ADD, MODIFY, and DELETE/DROP columns in the existing table, as well as, it is also used to ADD/DROP various constraints and triggers on an existing table.


ALTER TABLE with a default Value Query

This query will help you to alter a table by setting a default value. Let's suppose, you have a student table named "Student", then follow the query:


Alter Table Query Syntax


ALTER TABLE Student

ALTER COLUMN BirthCity SET DEFAULT 'TOKYO';

--------------------------------------------------------------------------

ALTER TABLE Student

ADD DEFAULT('TOKYO') FOR BirthCity;

1 votes

Your Answer

Email Us: advertise@gdatamart.com

Donate Us: Support to GDATAMART

LifeStyle & Fun

© 2024 GDATAMART.COM (All Rights Reserved)