I'm doing a test database with sqlite and have run into some problems. in my
1st table i have an id field:
id INTERGER Primary Key
the database has a few more fields, but when i insert into it, i leave the id
field empty as it should be done automatically, but sql complains with an error
that i have left the field blank. If i manually put the ids in, everything
works, but from my understanding this should be done automatically, aswell as
it auto incrementing?
i have two tables
table1 (id, field 2, field 3, field 4)
table2 (id, field 2, field 3, FOREIGN KEY (field 3) REFERENCES table1(id))
i initially had a problem as foreign keys is not enabled by default but as my
auto increment isnt working, can i just ask what does sql insert into field 3
of table2 as its a foreign key. Does it automatically insert the correspond id
of table1, or is it up to me to manually insert the correct data into table2
that match with the keys on table1? I ask only because i havent had a chance to
try it myself as i still have a problem with the keys, and strangely enough if
i put random text into the foreign key of table 2 that didnt reference any ids
on table1, sqlite still inserts them with no errors when they clearly ignore
the instructions given.
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor