[Tutor] Proper SQLite cursor handling?

Alan Gauld alan.gauld at yahoo.co.uk
Tue Jul 6 05:11:05 EDT 2021


On 06/07/2021 03:59, boB Stepp wrote:

>>         You should NOT have a table for each variant. Instead you should have
>> one table, which has a field pointing to the variant to which it applies...
>>
>>         Calling it "hand_number" is meaningless -- it is just a primary key ID
>> field
> 
> I disagree.  It has the meaning of the 1st hand played, the second
> hand, etc. This also makes it a good primary key.

Only if you have multiple tables, so that the tablename
effectively becomes part of the key. But if you only use
a single hand table then you need a composite key of
(gameType,handNo) Note: SQLite does support composite keys,
see my tutorial for an example in the address book.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list