Solved

Database SEtup QUestion

Posted on 2014-03-23
2
258 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
ID: 39949064
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
ID: 39957341
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
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…

786 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