How to Set Customer Table with Multiple Phone Numbers? - Relational Database Design

Posted by user311509 on Stack Overflow See other posts from Stack Overflow or by user311509
Published on 2010-04-08T01:22:02Z Indexed on 2010/04/08 1:23 UTC
Read the original article Hit count: 373

Filed under:
|
|
CREATE TABLE Phone
(
phoneID - PK
.
.
.
);

CREATE TABLE PhoneDetail
(
phoneDetailID - PK
phoneID - FK points to Phone
phoneTypeID ...
phoneNumber ...
.
.
.
);

CREATE TABLE Customer
(
customerID - PK
firstName
phoneID - Unique FK points to Phone
.
.
.
);

A customer can have multiple phone numbers e.g. Cell, Work, etc. phoneID in Customer table is unique and points to PhoneID in Phone table. If customer record is deleted, phoneID in Phone table should also be deleted.

Do you have any concerns on my design? Is this designed properly? My problem is phoneID in Customer table is a child and if child record is deleted then i can not delete the parent (Phone) record automatically.

© Stack Overflow or respective owner

Related posts about sql

Related posts about database