[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Create multiple sqlite tables, many-to-many design

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
>>> <python-list at python.org> wrote:
>>>> Some of the tables are related.? For example:
>>>> Hiking_Table???????????? Trails_Table??????????? Joining_Table
>>>> -----------------??????? --------------------??? -----------------
>>>> hike_id???? PK?????????? trail_id? PK??????????? hike_id?? FK
>>>> hike_date? TEXT????????? trail_name? TEXT??????? trail_id?? FK
>>>> hike_destination TEXT??? trail_rating REAL
>>>> hike_rating? REAL??????? trail_comments TEXT
>>>> hike_comments? TEXT
>> Might I also suggest dropping unnecessary prefixes from the field names. 
>> For example, "hike_comments" in "Hiking_Table" can be called just 
>> "comments" because it's clear from the context that a field called 
>> "comments" in the hiking table will contain comments about hiking, if 
>> you see what I mean.
> 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?
Definitely! :-)

Another thing you might want to avoid is naming something with what it 
is, e.g. "Trails_Table" (why not just "Trails").