- ALTER TABLE
- ALTER TABLE student ADD COLUMN nickname VARCHAR(30); #add a new column for nickname
- ALTER TABLE student ADD COLUMN lockerid INT DEFAULT '0' AFTER oldcol; #add a lockerid column
- ALTER TABLE student DROP COLUMN lockerid;
- ALTER TABLE student CHANGE COLUMN lockerid locker_id INT; #rename the lockerid column to locker_id
- ALTER TABLE student CHANGE COLUMN nickname nickname VARCHAR(50); # expand the nickname field
- in all the above examples, 'COLUMN' is optional
- ALTER TABLE student ORDER BY lname; # reorder the table's records permanently based on value of lname -- nonpersistant
- ALTER TABLE syntax reference
NEXT
PREVIOUS
Master Index