"Morten Gulbrandsen" <[EMAIL PROTECTED]> wrote: > 7.5.5.2 Foreign Key Constraints > > Hi programmers, > > I try to code this > > CREATE TABLE EMPLOYEE > ( > FNAME VARCHAR(15) NOT NULL, > MINIT CHAR, > LNAME VARCHAR(15) NOT NULL, > SSN CHAR(9) NOT NULL, > BDATE DATE, > ADDRESS VARCHAR(30), > SEX CHAR, > SALARY DECIMAL(10,2), > SUPERSSN CHAR(9), > DNO INT NOT NULL, > > PRIMARY KEY (SSN), > # INDEX (SUPERSSN, DNO), > FOREIGN KEY (SUPERSSN) REFERENCES EMPLOYEE(SSN), > FOREIGN KEY (DNO) REFERENCES DEPARTMENT(DNUMBER) > )TYPE = INNODB; > > And mysql complains with > > ERROR 1005 at line 9: Can't create table '.\company\employee.frm' > (errno: 150) > I think something is wrong with the index declaration, > or with the foreign key constraint.
Uncomment index declaration on SUPERSSN, DNO columns and create an index on DNO column. -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Victoria Reznichenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net <___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]