create table employees (
id int(5) not null auto_increment ,
name varchar(8) not null,
primary key (id)
)
type=innodb;
create table payroll(
id int(5) not null,
emp_id int(5) not null,
name varchar(8) not null,
payroll float(4,2) not null,
primary key(id),
index emp_id (emp_id),
foreign key (emp_id) references employees (id)
)
type = innodb;
本文转自 小强测试帮 51CTO博客,原文链接:http://blog.51cto.com/xqtesting/808468,如需转载请自行联系原作者