SQL – ALTER TABLE statement (to modify table definition)

SQL - ALTER TABLE statement (to modify table definition)

SQL – ALTER TABLE explanation: Here, we will figure out how to adjust a table’s definition like including sections, expelling segments, changing the information type size and so on.

Change TABLE proclamation is utilized to adjust the definition/structure of the table. We can utilize an ALTER TABLE to include, drop and change fields/limitations of the table.

Test table (Student),

1) To include a segment in the table

ALTER TABLE Student ADD (Gender varchar(1), Percentage varchar(11));

This will include another field of the name sexual orientation in the table.

SQL - ALTER TABLE statement (to modify table definition)

2) To include different sections in the table

ALTER TABLE Student ADD (Gender varchar(1), Percentage varchar(11));

This will include different sections/fields.

SQL - ALTER TABLE statement (to modify table definition)

3) To drop a segment in the table

ALTER TABLE Student DROP COLUMN Gender;

This drop segment gender.

SQL - ALTER TABLE statement (to modify table definition)

4) To adjust a section in the table

ALTER TABLE Student MODIFY COLUMN Physics integer;

This will change over the information kind of Physics section of Student table.

SQL - ALTER TABLE statement (to modify table definition)

Recent Posts

error: Alert: Content is protected!!