Results 1 to 4 of 4
  1. #1
    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

  2. #2
    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

  3. #3
    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 Thumbnails Attached Thumbnails ER.bmp.bmp  

  4. #4
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •