0

Hei, im trying to add new table Order line

CREATE TABLE Ordrelinje ( OrdreNr INTEGER NOT NULL, PNr CHAR(5) NOT NULL, PrisPrEnhet DECIMAL(8,2) NOT NULL, Antall INTEGER NOT NULL, PRIMARY KEY ( OrdreNr, PNr ), INDEX (OrdreNr), INDEX (PNr), FOREIGN KEY ( OrdreNr ) REFERENCES Ordre(OrdreNr), FOREIGN KEY ( PNr ) REFERENCES Produkt(PNr) ) ENGINE=InnoDB;

phpmyadming gives me message

' #1005 - Can't create table 'pizza.ordrelinje' (errno: 150) '

I think its something wrong with primary, foreign keys of other tables but im not pretty sure. How should i solve this problem?

  • Show schema for `ordre` and `Produkt` table. – Rahul Nov 18 '14 at 21:41
  • Look at http://stackoverflow.com/questions/4061293/mysql-cant-create-table-errno-150 it seems to be the same error. – Veve Nov 18 '14 at 21:43
  • ORDRETABLE OrdreNr Dato Antall Pris PNr Epost PRODUKTTABLE PNr PNavn Pris –  Nov 18 '14 at 21:50
  • possible duplicate of [MySQL Foreign Key Error 1005 errno 150](http://stackoverflow.com/questions/4063141/mysql-foreign-key-error-1005-errno-150) – Vyktor Nov 18 '14 at 21:57
  • SOLVED IT! it was incompatible types thanks! –  Nov 18 '14 at 22:00

0 Answers0