Subject: DDL issue

From: Rich Shepard <[email-masked]>
Date: Thu, 12 Sep 2024 16:01:30 -0700 (PDT)

I have one name in the people table who owns 5 different dairies with three
different phone numbers, but all 5 have the the same email address.

The five dairies each has its own name and location while the people table
has five rows with the same last and first names and email address.

Is there a way to have only one entry for the owner in the people table
while related to five different company names? In some industries, such as
dairy farms, this is not an unusual situation.

TIA,

Rich

---

From: Adrian Klaver <[email-masked]>
Date: Thu, 12 Sep 2024 16:46:51 -0700

> dairy farms, this is not an unusual situation.

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 Klaver
[email-masked]

---

From: Rich Shepard <[email-masked]>
Date: Fri, 13 Sep 2024 05:38:30 -0700 (PDT)

> 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

---

From: Rich Shepard <[email-masked]>
Date: Fri, 13 Sep 2024 09:27:33 -0700 (PDT)

Adrian,

This comes close; I need to think about this.

Thanks,

Rich