Its been a while since I did any seriously complex SQL, and so I've forgotten :s
Is it possible to have multiple foreign keys in a table? and if that is possible, can I have a foreign key which might contain a null?
My reason for doing this is that i have a list of countries in one table and a list of US states in another, and as everyone registering might not be from the US obviously the state field will contain a null.
I'm using MySQL and using the innodb engine so i have foreign key constraints.
Question
StuRReaL
Its been a while since I did any seriously complex SQL, and so I've forgotten :s
Is it possible to have multiple foreign keys in a table? and if that is possible, can I have a foreign key which might contain a null?
My reason for doing this is that i have a list of countries in one table and a list of US states in another, and as everyone registering might not be from the US obviously the state field will contain a null.
I'm using MySQL and using the innodb engine so i have foreign key constraints.
Link to comment
https://www.neowin.net/forum/topic/280665-foreign-keys/Share on other sites
4 answers to this question
Recommended Posts