Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6780701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:32:13+00:00 2026-05-26T16:32:13+00:00

I have a relational database with a Client table, containing id , name ,

  • 0

I have a relational database with a Client table, containing id, name, and address, with many phone numbers
and I have an Employee table, also containing id, name, address, etc., and also with many phone numbers.

Is it more logical to create one “Phone Number” table and link the Clients and Employees, or to create two separate “Phone Number” tables, one for Clients and one for Employees?

If I choose to create one table, can I use one foreign key for both the Client and Employee or do I have to make two foreign keys?

If I choose to make one foreign key, will I have to make the Client ids start at 1 and increment by 5, and Employee ids start at 2 and increment by 5 so the two ids will not be the same?

If I create two foreign keys will one have a value and the other allow nulls?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T16:32:13+00:00Added an answer on May 26, 2026 at 4:32 pm

    The solution which I would go with would be:

    CREATE TABLE Employees (
        employee_id    INT            NOT NULL,
        first_name     VARCHAR(30)    NOT NULL,
        ...
        CONSTRAINT PK_Employees PRIMARY KEY (employee_id)
    )
    
    CREATE TABLE Customers (
        customer_id    INT            NOT NULL,
        customer_name  VARCHAR(50)    NOT NULL,
        ...
        CONSTRAINT PK_Customers PRIMARY KEY (customer_id)
    )
    
    -- This is basic, only supports U.S. numbers, and would need to be changed to
    -- support international phone numbers
    CREATE TABLE Phone_Numbers (
        phone_number_id    INT            NOT NULL,
        area_code          CHAR(3)        NOT NULL,
        prefix             CHAR(3)        NOT NULL,
        line_number        CHAR(4)        NOT NULL,
        extension          VARCHAR(10)    NULL,
        CONSTRAINT PK_Phone_Numbers PRIMARY KEY (phone_number_id),
        CONSTRAINT UI_Phone_Numbers UNIQUE (area_code, prefix, line_number, extension)
    )
    
    CREATE TABLE Employee_Phone_Numbers (
        employee_id        INT    NOT NULL,
        phone_number_id    INT    NOT NULL,
        CONSTRAINT PK_Employee_Phone_Numbers PRIMARY KEY (employee_id, phone_number_id)
    )
    
    CREATE TABLE Customer_Phone_Numbers (
        customer_id        INT    NOT NULL,
        phone_number_id    INT    NOT NULL,
        CONSTRAINT PK_Customer_Phone_Numbers PRIMARY KEY (customer_id, phone_number_id)
    )
    

    Of course, the model might changed based on a lot of different things. Can an employee also be a customer? If two employees share a phone number how will you handle it on the front end when the phone number for one employee is changed? Will it change the number for the other employee as well? Warn the user and ask what they want to do?

    Those last few questions don’t necessarily affect how the data is ultimately modeled, but will certainly affect how the front-end is coded and what kind of stored procedures you might need to support it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a relational database with about 100 tables. Each table has unique, numerical,
I heard that decision tables in relational database have been researched a lot in
I have quite a problem concerning the use of relational database concepts in Delphi
I have a question about Criteria method, one-to-many relation to the database, 'one' is
I have a database that have quite a bit relational user information that would
I have heard some genuine arguments for the use of relational database vs spreadsheet
I have a relational database with about 15 tables that will be used in
So you have a relational database and you define some foreign keys for reference
Lets say you have a relational database of arbitrary but finite capacity, and the
I have a recursive hierarchy in a relational database, this reflects teams and their

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.