约束,列的增删操作
create table product
(
id int PRIMARY KEY auto_increment,
pname varchar(20) unique not null, //增加两个约束
pcoutn int not null,
oid int,
kid int,
FOREIGN key (oid )REFERENCES order1(id),
FOREIGN KEY(kid)REFERENCES kind(id)
)
alter table kind modify spec varchar (20)not null;//增加约束
alter table kind add tel VARCHAR(20); //增加列
alter table order1 drop( column) oid; //删除列
alter table kind modify spec varchar(20); //删除约束
alter table order1 add id int PRIMARY KEY; //增加列
alter table order1 change spec spec; //修改列名
alter table kind modify spec VARHAR(30) not null //修改类型,字符大小,约束条件通用格式。
alter table change name name1;//修改列名
rename table student to studet1;//修改表名