sql - Create table error in MySQL -
any ideas why can not create clinical_questions table?
create table if not exists `test`.`questions` ( `questionid` int not null , `question` varchar(45) null , `versionnumber` int null , `core` tinyint(1) null , primary key (`questionid`) ) engine = innodb; i can not create table
create table if not exists `test`.`clinical_questions` ( `clinicalid` int not null , `questionid` int null , `effective week` int null , primary key (`clinicalid`) , index `questionid_idx` (`questionid` asc) , constraint `questionid` foreign key (`questionid` ) references `test`.`questions` (`questionid` ) on delete no action on update no action, constraint `clinicalid` foreign key (`clinicalid` ) references `test`.`clinical` (`clinicalid` ) on delete no action on update no action) engine = innodb; error 1005 (hy000): can't create table 'certestdb.clinical_questions' (errno: 121)
create table if not exists `test`.`overall_week_rating` ( `clinicalid` int not null , `instructor_rating` int null , `datetime_instructor_rating` datetime null , `student_rating` int null , `datetime_student_rating` datetime null , primary key (`clinicalid`) , constraint `userid` foreign key (`clinicalid` ) references `test`.`clinical` (`clinicalid` ) on delete no action on update no action) engine = innodb;
you have error in create table statement somewhere on declaration if index. should remove asc index part.
index `section_idx` (`question_section`) the second problem arise have no key define on foreign key constraint,
constraint cons_effectivedate foreign key (`effective date`) -- add column name references `certestdb`.`section` (columnhere) -- add column name on delete no action on update no action
Comments
Post a Comment