2. ALTER table to add new attributes / modify data type / drop attribute.

 

SQL

-- Add a new attribute 'address'

ALTER TABLE Student ADD address VARCHAR(100);

 

-- Modify data type of 'age' to SMALLINT

ALTER TABLE Student MODIFY age SMALLINT;

 

-- Drop the 'major' attribute

ALTER TABLE Student DROP COLUMN major;

No comments:

Post a Comment