Database SEtup QUestion

Hi All,

I am trying to setup a company database with this data, let me know the best setup for this.  There could be up to 20 contacts per company:

company name
Address
Main Number
Industry
Website


Direct Contact 1
phone Number
email address
address

Direct Contact 2
phone number
email address
address
Jack_son_Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
lcohanConnect With a Mentor Database AnalystCommented:
Something like:

create table company
(
      company_id int primary key,
      company_name varchar(255),
      company_Address varchar(255),
      Main_Number int,
      Industry varchar(100),
      Website varchar(2000)
);

create table contacts
(
      contact_id int primary key,
      company_id int,
      contact_first_name varchar(100),
      contact_last_name varchar(100),
      phone_Number varchar(100),
      email_address  varchar(100),
      contact_address  varchar(100),
      contact_city  varchar(100),
      contact_state_province  varchar(100),
      contact_country  varchar(100),
      contact_postal_code  varchar(20)-- ...etc...
);


ALTER TABLE contacts ADD FOREIGN KEY (FK_company_id) REFERENCES company(company_id);
0
 
Dan CraciunConnect With a Mentor IT ConsultantCommented:
Doesn't matter how many contacts there are.
Setup a table for companies and a table for contacts, with a company_id foreign key in the contacts table.

HTH,
Dan
0
All Courses

From novice to tech pro — start learning today.