I have an SQLite database, with a table having an auto increment integer as a primary key, and another table that is linked to this first table, through a foreign key. I don't understand how I can choose which row from the first table is to link with the right row from the second table.
Let me illustrate with an example :
Table student with auto increment primary key (0, 1, 2, ..., 10)
Table courses with these rows : name = 'French', grade = 'B', student (foreign key) = 3
How can I tell the database that the student 3 got B in French? Because I don't know which primary key (auto number) as been assigned to a student, I just know his name.
classID, studentID, result_value, so basically you'd insert('spring 2015 french', 'john doe student ID', 'B'). presumably the student would already have to exist elsewhere in your table, e.g. in an enrolment table. so get the ID of that record: stackoverflow.com/questions/8892973/… - Marc B