Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.postgresql > #867

Re: Table with a variable number of elements in a column

Path csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Bill Gunshannon <bill.gunshannon@gmail.com>
Newsgroups comp.databases.postgresql
Subject Re: Table with a variable number of elements in a column
Date Sat, 27 Apr 2019 18:40:10 -0400
Lines 39
Message-ID <gik42aF8vneU1@mid.individual.net> (permalink)
References <gijn3vF68nnU1@mid.individual.net> <gijpelF6n73U1@mid.individual.net> <gijpvpF6sfbU1@mid.individual.net> <gijqqoF71obU1@mid.individual.net> <gijsdrF7d5iU1@mid.individual.net> <gijuppF7slsU1@mid.individual.net>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
X-Trace individual.net +kwlo46NXLVa+ldZRQEkFQ2y5GswNvcqYHN92dWAibmbaSt3RT
Cancel-Lock sha1:XC4eBnjM878hhBfQF6ugopiT6hs=
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1
In-Reply-To <gijuppF7slsU1@mid.individual.net>
Content-Language en-US
Xref csiph.com comp.databases.postgresql:867

Show key headers only | View raw


On 4/27/19 5:10 PM, John-Paul Stewart wrote:
> On 2019-04-27 4:29 p.m., Bill Gunshannon wrote:
>> On 4/27/19 4:02 PM, John-Paul Stewart wrote:
>>> On 2019-04-27 3:48 p.m., Bill Gunshannon wrote:
>>>>
>>>> But if I understand this correctly I would need a separate table for
>>>> every album resulting in, potentially, thousands of tables. (OK, in
>>>> my case hundreds but others may like this idea, too, when I finish
>>>> the whole project.)
>>>
>>> No, it's only one "tracks" table.  That's why there's an album id column
>>> in it:  so that each track is associated with one album.  There'd be
>>> (album 1, track 1), (album 1, track 2), (album 2, track 1), and so
>>> on....  Each (album, track) tuple would have to be unique.  But you'd
>>> keep all the tracks for all the albums in one table.
>>
>> I got that now.
>> But I guess I am still stuck with how I define how many tracks columns
>> there has to be for each album.  I think I have been away from this for
>> too long.  I am missing something that is probably both simple and very
>> apparent.
> 
> By using a tracks table, it's no longer a question of "how many tracks
> columns" but "how many tracks rows" instead. And the answer is "however
> many you populate with the same album id".  That's the beauty of it.
> 

Yeah, I went upstairs to watch the golf and think about it and
it hit me.  I was looking at it all wrong.  I was trying to label
the field for each track but being as they are merely sequentially
numbered values they don't need individual names.  Duh...

Hopefully other stuff will come back to the surface easier than this.

Thank you very much for kicking me in the head to knock this stuff
loose so it could float back up to the surface.

bill

Back to comp.databases.postgresql | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Table with a variable number of elements in a column Bill Gunshannon <bill.gunshannon@gmail.com> - 2019-04-27 14:59 -0400
  Re: Table with a variable number of elements in a column John-Paul Stewart <jpstewart@sympatico.ca> - 2019-04-27 15:39 -0400
    Re: Table with a variable number of elements in a column Bill Gunshannon <bill.gunshannon@gmail.com> - 2019-04-27 15:48 -0400
      Re: Table with a variable number of elements in a column John-Paul Stewart <jpstewart@sympatico.ca> - 2019-04-27 16:02 -0400
        Re: Table with a variable number of elements in a column Bill Gunshannon <bill.gunshannon@gmail.com> - 2019-04-27 16:29 -0400
          Re: Table with a variable number of elements in a column John-Paul Stewart <jpstewart@sympatico.ca> - 2019-04-27 17:10 -0400
            Re: Table with a variable number of elements in a column Bill Gunshannon <bill.gunshannon@gmail.com> - 2019-04-27 18:40 -0400
              Re: Table with a variable number of elements in a column John-Paul Stewart <jpstewart@sympatico.ca> - 2019-04-27 19:26 -0400
  Re: Table with a variable number of elements in a column alexander.d.mills@gmail.com - 2020-02-21 14:02 -0800
    Re: Table with a variable number of elements in a column Christian Barthel <bch@online.de> - 2020-02-22 09:15 +0100

csiph-web