Re: Create multiple sqlite tables, many-to-many design

2019-08-15 Thread Peter Otten
Chris Angelico wrote: > On Thu, Aug 15, 2019 at 7:41 PM Gregory Ewing > wrote: >> >> Chris Angelico wrote: >> > I prefer to say "Trails" for the table, and "Trail" would then refer >> > to a single row from that table. >> >> That makes sense for a data structure in your program that contains a

Re: Create multiple sqlite tables, many-to-many design

2019-08-15 Thread Chris Angelico
On Thu, Aug 15, 2019 at 7:41 PM Gregory Ewing wrote: > > Chris Angelico wrote: > > I prefer to say "Trails" for the table, and "Trail" would then refer > > to a single row from that table. > > That makes sense for a data structure in your program that contains a > collection of rows. But I've

Re: Create multiple sqlite tables, many-to-many design

2019-08-15 Thread Gregory Ewing
Chris Angelico wrote: I prefer to say "Trails" for the table, and "Trail" would then refer to a single row from that table. That makes sense for a data structure in your program that contains a collection of rows. But I've come to the view that SQL tends to read better if the names of the

Re: Create multiple sqlite tables, many-to-many design

2019-08-14 Thread Rich Shepard
On Wed, 14 Aug 2019, Chris Angelico wrote: I prefer to say "Trails" for the table, and "Trail" would then refer to a single row from that table. +1 Rich -- https://mail.python.org/mailman/listinfo/python-list

Re: Create multiple sqlite tables, many-to-many design

2019-08-14 Thread Chris Angelico
On Wed, Aug 14, 2019 at 9:06 PM Gregory Ewing wrote: > > MRAB wrote: > > Another thing you might want to avoid is naming something with what it > > is, e.g. "Trails_Table" (why not just "Trails"). > > Or possibly just "Trail", since any table potentially contains > multiple rows, so making all

Re: Create multiple sqlite tables, many-to-many design

2019-08-14 Thread Gregory Ewing
MRAB wrote: Another thing you might want to avoid is naming something with what it is, e.g. "Trails_Table" (why not just "Trails"). Or possibly just "Trail", since any table potentially contains multiple rows, so making all your table names plural doesn't add any information. -- Greg --

Re: Create multiple sqlite tables, many-to-many design

2019-08-13 Thread Rich Shepard
On Wed, 14 Aug 2019, MRAB wrote: The actual code is different. htbl, ttbl, jtbl, etc. Too short? Definitely! :-) Another thing you might want to avoid is naming something with what it is, e.g. "Trails_Table" (why not just "Trails"). Another reason to read Celko's 'SQL Programming Style.'

Re: Create multiple sqlite tables, many-to-many design

2019-08-13 Thread MRAB
On 2019-08-13 22:11, Dave via Python-list wrote: On 8/13/19 4:45 PM, MRAB wrote: On 2019-08-13 19:59, Chris Angelico wrote: On Wed, Aug 14, 2019 at 4:50 AM Dave via Python-list wrote: Some of the tables are related.  For example: Hiking_Table Trails_Table   

Re: Create multiple sqlite tables, many-to-many design

2019-08-13 Thread Dave via Python-list
On 8/13/19 5:46 PM, Rich Shepard wrote: On Tue, 13 Aug 2019, Rich Shepard wrote: Read Joe Celko's books, starting with his SQL Programming Guide, then SQL That should be SQL Programming Style Rich Rich, On my next trip to BN I'll see if they have them. That is long term though. Right

Re: Create multiple sqlite tables, many-to-many design

2019-08-13 Thread Rich Shepard
On Tue, 13 Aug 2019, Rich Shepard wrote: Read Joe Celko's books, starting with his SQL Programming Guide, then SQL That should be SQL Programming Style Rich -- https://mail.python.org/mailman/listinfo/python-list

Re: Create multiple sqlite tables, many-to-many design

2019-08-13 Thread Chris Angelico
On Wed, Aug 14, 2019 at 7:26 AM Dave via Python-list wrote: > Thanks for the note. I get the theory of MTM and the join table. It is > the implementation I don't get. Let me see if I can demonstrate my > confusion using pseudo code. > > def dbDataInsert(): > > sql_HikeInsert = """ INSERT

Re: Create multiple sqlite tables, many-to-many design

2019-08-13 Thread Rich Shepard
On Tue, 13 Aug 2019, Dave via Python-list wrote: I do indeed. I did that so it was easy for everyone to follow. Having started with assm. and C, I have to remind myself to be more explanatory in naming. Guess I over-did it. The actual code is different. htbl, ttbl, jtbl, etc. Too short? Dave,

Re: Create multiple sqlite tables, many-to-many design

2019-08-13 Thread Dave via Python-list
On 8/13/19 2:59 PM, Chris Angelico wrote: On Wed, Aug 14, 2019 at 4:50 AM Dave via Python-list wrote: Some of the tables are related. For example: Hiking_Table Trails_TableJoining_Table -- hike_id PK

Re: Create multiple sqlite tables, many-to-many design

2019-08-13 Thread Dave via Python-list
On 8/13/19 4:45 PM, MRAB wrote: On 2019-08-13 19:59, Chris Angelico wrote: On Wed, Aug 14, 2019 at 4:50 AM Dave via Python-list wrote: Some of the tables are related.  For example: Hiking_Table Trails_Table    Joining_Table -       

Re: Create multiple sqlite tables, many-to-many design

2019-08-13 Thread MRAB
On 2019-08-13 19:59, Chris Angelico wrote: On Wed, Aug 14, 2019 at 4:50 AM Dave via Python-list wrote: Some of the tables are related. For example: Hiking_Table Trails_TableJoining_Table -- hike_id PK

Re: Create multiple sqlite tables, many-to-many design

2019-08-13 Thread Chris Angelico
On Wed, Aug 14, 2019 at 4:50 AM Dave via Python-list wrote: > Some of the tables are related. For example: > > Hiking_Table Trails_TableJoining_Table > -- > hike_id PK trail_id PK

Create multiple sqlite tables, many-to-many design

2019-08-13 Thread Dave via Python-list
Oops! Just posted this to the wrong newsgroup. Sorry!!! I'm doing a Python app that uses SQLite, and am stumbling on a few questions. I've read a lot of books and documentation, but two questions still allude me. Hope someone