Solved

Database SEtup QUestion

Posted on 2014-03-23
2
259 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
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.

832 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