Best unofficial Apache Server developers community |
|
I have an sqlite database structured as follows:
I insert a Patient with Id #1 then I run:
which works then I run:
and it gives me a foreign key mismatch. Patient Id is '1' in all cases, and the datetime and typecodes match in the 2nd and 3rd queries. I do not understand what is mismatching, but I'm a bit new to actually defining foreign keys and i do not know what I am doing wrong.
posted via StackOverflow
|
|
 
|
I'm not familiar with SQLite but a little Google'ing turned up this. The documentation says
I suspect you might be running into #3 in that list. Also, while other DBs might support using a non-unique index as a foreign key reference, (see answers here), it's a bad design choice in my opinion. I would restructure so that either
I'd suggest #2 so that you can avoid the redundancy of |