mysql笔记2012-03-05
unsigned表示无符号,也就是非负数,只能用于整型数据。
建立外键关系
create table dept(id smallint unsign auto_increment,name varchar
(50),primary key(id));
查看建立表的SQL代码
show create table dept \G;
create table employee (id smallint unsign auto_increment,name varchar
(100),deptno smallint unsigned,contraint fk_employee_deptno forgein key
(deptno) reference dept(id) on delete no action on update cascade,primary
key(id))
建立外键关系
create table dept(id smallint unsign auto_increment,name varchar
(50),primary key(id));
查看建立表的SQL代码
show create table dept \G;
create table employee (id smallint unsign auto_increment,name varchar
(100),deptno smallint unsigned,contraint fk_employee_deptno forgein key
(deptno) reference dept(id) on delete no action on update cascade,primary
key(id))