www.webdeveloper.com
Results 1 to 2 of 2

Thread: Creating an ERD

  1. #1
    Join Date
    Sep 2004
    Location
    At the corner of WALK and DONT WALK
    Posts
    1,714

    Creating an ERD

    Following eval(BadCode)'s advice, I have created an ERD for my database. However, there are a few questions I've got creating an ERD.

    Question 1
    The 'teams' table has two foreign keys ("was" and "became") that refer to the primary index in the 'teams' table. That's not a typo; those two keys state previous and subsequent identities of the teams.

    For example, the St. Paul Mayors (SPM) became the Huntsville Mayors (HNT), so under the St. Paul Mayors entry, the "became" field has the value "HNT", while the Huntsville Mayors entry has "SPM" in the "was" field.

    Question 2
    How do I show that multiple foreign keys in a table refer to the SAME key in another table? Under my 'colors' table, "logo_by", "large_logo_by", and "alt_logo_by" all refer to the "cont_id" field in the 'contributers' table. How do I show that?

    I'm using crow's foot notation here.

  2. #2
    Join Date
    Jul 2010
    Location
    /ramdisk/
    Posts
    865
    I have a document written by my teacher. Fortunately for you: it walks you through the entire process using major league baseball

    Answer to Question 1:
    The PDF shows you how to capture an event.
    hint: It's a weak entity.

    Answer to Question 2:
    The PDF also covers that same exact thing.


    http://vircaelum.net/ERD.pdf

    The first 15 pages is all ERD stuff.
    The last 15 pages is all writing queries.
    Edit: The first 2 pages are actually an intro.

    It's not all words like a book, it's a lot of schema, ERDs, and queries.

    A few notes before reading it:
    1) the joins at the end are written in longhand. Don't be fooled into thinking you have to do that
    2) it might also help to understand what normalization up to 3N is. Past 3N it's just heads. When the data is normalized and you have your ERD... Your database becomes the golden gun from 007. If you don't use stored procedures (I don't) then you might benefit from creating a few views for joining the tables back together.
    Last edited by eval(BadCode); 12-24-2010 at 12:15 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles