Solved

Database SEtup QUestion

Posted on 2014-03-23
2
253 Views
Last Modified: 2014-04-22
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
0
Comment
Question by:Jack_son_
2 Comments
 
LVL 34

Assisted Solution

by:Dan Craciun
Dan Craciun earned 250 total points
Comment Utility
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
 
LVL 39

Accepted Solution

by:
lcohan earned 250 total points
Comment Utility
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

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now