Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create table patient_room
- (
- pr_id int NOT NULL PRIMARY KEY auto_increment,
- patient_id int NOT NULL,
- room_id int NOT NULL,
- )ENGINE = InnoDB;
- create table patients
- (
- patient_id int primary key not null auto_increment,
- fname varchar(30),
- lname varchar(30),
- suffix enum('I','II','III','IV','JR','SR'),
- sex enum('M','F','U','T'),
- eye_color enum('BK','BR','BL','GY','GR','HZ','MN','DX','UN'),
- hair_color enum('BK','BR','BN','RD','WH','SN','BD','UN'),
- date_of_birth date not null,
- height int unsigned not null,
- weight int unsigned not null,
- admitted datetime not null
- ) Engine = InnoDB;
- alter table patient_room add foreign key (patient_id) references patient(patient_id) on delete cascade on update cascade;
- ERROR 1005 (HY000): Can't create table 'Mthomas.#sql-3dac_5f1' (errno: 150)
- alter table patient_room add foreign key (room_id) references room(room_id) on delete cascade on update cascade;
- alter table patient_room add foreign key (patient_id) references patient(patient_id) on delete cascade on update cascade;
- alter table patient_room add foreign key (patient_id) references patients(patient_id) on delete cascade on update cascade;
- ^
Add Comment
Please, Sign In to add comment