Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sp5ZL-00GPwt-2y for pgsql-general@arkaria.postgresql.org; Fri, 13 Sep 2024 12:38:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sp5ZK-002IVw-Kc for pgsql-general@arkaria.postgresql.org; Fri, 13 Sep 2024 12:38:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sp5ZK-002IV9-9M for pgsql-general@lists.postgresql.org; Fri, 13 Sep 2024 12:38:34 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sp5ZH-000xta-Hd for pgsql-general@postgresql.org; Fri, 13 Sep 2024 12:38:33 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 08B312A14D6 for ; Fri, 13 Sep 2024 05:38:30 -0700 (PDT) Date: Fri, 13 Sep 2024 05:38:30 -0700 (PDT) From: Rich Shepard To: pgsql-general@postgresql.org Subject: Re: DDL issue In-Reply-To: Message-ID: <4fb4a8d4-5f3a-b4aa-6b10-8b95d349941@appl-ecosys.com> References: <91bda8-3bdb-d93-6c17-41a03a3de27a@appl-ecosys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 12 Sep 2024, Adrian Klaver wrote: > Quick and dirty: > > people_table > person_id PK > name_last > name_first > email_address > ph_number > ... > > location_table > loc_id PK > person_id_fk FK <--> people_table(person_id) > loc_name > loc_st_addr > loc_st_city > loc_st_st_prov > ... > > contact_table > contact_id PK > loc_id_fk FK <--> location_table(loc_id) > contact_ph_number > contact_email --Can be null > > It can get more involved then this, depends on how flexible you want to get. Adrian, There are many companies with multiple locations, but few owners with multiple companies, each with a different location. David's reminder about many-to-many tables will do the job. Thanks, Rich