Separate names with a comma.
Discussion in 'Mac Programming' started by dukebound85, Jun 27, 2017.
amyone know why I am getting this error? I can't seem to have the foreign key work
Please copy and paste the complete actual text from the Terminal window.
1. Your photo cuts off a significant part of the error message. Details are important in programming.
2. Which SQL app or command-line tool is this appearing in? Again, details are important.
3. The thread title says "error 150", but the picture shows "ERROR 1005" and "errno: 150". Those are different things.
errno is an error variable, and the values it can take on are usually documented. See 'man 2 intro' (cmd to type in Terminal) for a discussion of errno and the typical system-provided values. 150 is well above that range, which suggests your SQL engine or app or tool is setting errno to that value. You'd have to refer to the programming manual to find out what an errno of 150 means. You might also find that the code in parens, i.e. HY1000, has some meaning for decoding the error.
If you're using MySQL, try this syntax:
FOREIGN KEY (PersonID) REFERENCES Persons(PersonID)
Pulled from this page:
Found by googling: sql foreign key syntax
If you're using sqliteN, it has the same syntax:
Found by googling: sqlite foreign key syntax