当前位置: 动力学知识库 > 问答 > 编程问答 >

Cant create table for some reason MySQL

问题描述:

I can't create a table for some reason and I just keep getting the following error.

ERROR 1005 (HY000): Can't create table 'onesec.students' (errno: 121)

create table students (

student_id int not null,

fname varchar(34),

lname varchar(34),

unitid int,

lectid int,

primary key (lectid),

constraint unitFK foreign key (unitid) references units(unitid),

constraint lectFK foreign key (lectid) references lecturers(lectid));

Anyone knows why? help would be appreciated thanks.

Sorry guys heres the other two tables

create table unit (

unitid int primary key,

unit_name varchar(34));

create table lecturers (

lectid int not null,

fname varchar(34),

lname varchar(34),

unitid int,

primary key (lectid),

constraint unitFK foreign key (unitid) references units(unitid);

分享给朋友:
您可能感兴趣的文章:
随机阅读: