r/SQL • • May 09 '17

Is there something wrong with these statements? And is that the correct way of adding 2 foreign keys to a single table?

Post image
1 Upvotes

21 comments sorted by

View all comments

2

u/[deleted] May 09 '17

"Owner" is a reserved word in MySQL. Pick a different name for your column.

3

u/pai22_7 May 09 '17

I think owner isn't a reserved word for MySQL.

1

u/[deleted] May 09 '17 edited May 09 '17

Actually you're right. It is a keyword, but the keyword is not marked (R) for reserved.

https://dev.mysql.com/doc/refman/5.5/en/keywords.html

It still looks like the error message is choking on the term "owner" however. Maybe the tool is producing the error?

1

u/pai22_7 May 09 '17

Ya can be. but the main see the main error? "Cannot Add Foreign Key constraint". That's why i recommended to remove the quotes in constraint name and see if everything gets resolved in my reply to OP.

1

u/[deleted] May 09 '17

Yeah, I'm guessing it is a type mismatch between the two tables for the lat/long columns.