SQLite Forum

Mismatch in query results
A couple of notes:

Although I think your definition for <code>PRIMARY KEY</code> will work fine, there are reasons why you might want to define those values slightly differently.  I recommend you take a look at


Also you can enforce the parent / child relationship using <code>FOREIGN KEY</code>s.  That way your database will not allow such things to happen:


However, your data structure is good and you seem to understand how to proceed, so perhaps you're okay without it.