第四节 修改表结构之alter
1 -- 添加字段和外键:ALTER...ADD... 2 ALTER TABLE t_student ADD birthday DATETIME; 3 ALRER TABLE t_student ADD FOREIGN KEY (t_student_id) REFERENCES good_id; 4 5 -- 修改字段的数据类型和约束:ALTER...MODIFY... 6 ALTER TABLE t_student MODIFY birthday DATA NOT NULL; 7 8 -- 修改字段名:ALTER...CHANGE... 9 ALTER TABLE t_student CHANGE birthday birth DATE; 10 11 -- 删除字段:alter...drop... 12 ALTER TABLE t_student DROP birthday;