If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Easy Database-question!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-26-07, 08:52
danneny danneny is offline
Registered User
 
Join Date: Feb 2007
Posts: 6
Easy Database-question!

I'm totally new to databases, and i have an (i guess) easy question.

I have a domain that contains companies and their employees. I would like to design a database that contains information about
- Name and adress of different companies
- Name and birth dates for the empolyees
- Who is working on what company.

How would an Entity-Relationship-diagram, including keys, look that is modelling this domain? I would also like to translate the ER-diagram to relations.

Very thankful for your help!

Danne
Reply With Quote
  #2 (permalink)  
Old 02-26-07, 09:02
RedNeckGeek RedNeckGeek is offline
Village Idiot
 
Join Date: Jul 2003
Location: Michigan
Posts: 1,941
What have you got so far? We'll gladly help you along, but won't do the work for you.
__________________
Inspiration Through Fermentation
Reply With Quote
  #3 (permalink)  
Old 02-26-07, 09:35
danneny danneny is offline
Registered User
 
Join Date: Feb 2007
Posts: 6
This is what i've done.

The problem is i wanna specify who is working on what company. How is that possible?

Thank you!
Attached Images
File Type: bmp ER.bmp.bmp (286.5 KB, 50 views)
Reply With Quote
  #4 (permalink)  
Old 02-26-07, 09:42
RedNeckGeek RedNeckGeek is offline
Village Idiot
 
Join Date: Jul 2003
Location: Michigan
Posts: 1,941
You're pretty close. The "works at" box in your diagram is your key field.
You would want to call it something like "CompanyID", and make it an autonumber field in the company table. It would be the primary key there.

You add that field as a foreign key to the employee table.

COMPANY
CompanyID (Primary Key)
CompanyName
Company Address
...

Employee
EmployeeID (Primary Key)
CompanyID (Foreign Key)
EmployeeName
EmployeeAddress
...
__________________
Inspiration Through Fermentation
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On