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.
2) To include different sections in the table
ALTER TABLE Student ADD (Gender varchar(1), Percentage varchar(11));
This will include different sections/fields.
3) To drop a segment in the table
ALTER TABLE Student DROP COLUMN Gender;
This drop segment gender.
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.