Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    2

    Stumped on design of a database

    Hi

    I was stuck on the designing a database.

    It goes something like this -


    Many buses can access many bus stops.

    e.g. there are 5 bus -stops , and bus numbers are 22, 11, 13, 77.

    Each of these buses would/could access any of the 5 bus stops.

    In order to resolve this many -many relationship, I made a 3rd entity
    bus_journey with two primary keys busstopID and BusID initially
    considering, that each bus journey would be uniquely associated with a
    bus with only a single bus stop.

    However, this fails, since in a bus journey, a bus can access multiple
    bus stations.

    e.g. in a bus journey, Bus no 11 can travel around and access bus stations 1,2, and 3.

    I am out of ideas on the design of this relation between them..

    How could you relate these two entities in an ERD ?

    Any suggestions would be very helpful


    Here's the database design

    [img=http://img266.imageshack.us/img266/2008/untitledpr5.th.jpg]

    Best regards

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by amol0010
    How could you relate these two entities in an ERD ?
    just like you did already in the database diagram

    oh, wait -- is the reason you're asking about ERDs because you need to hand in an ERD for this assignment?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jul 2007
    Location
    United Kingdom
    Posts
    2
    ^No actually its because I need to use this database to feed in real data sourced from the local travel company and display it on my webpage..

    I need to use this db in MySQL.

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Go back to basics for this one...
    Try expanding on this
    Quote Originally Posted by amol
    Many buses can access many bus stops.
    One line statements for the relationships between each of your objects and post them all back here - this should help clarify the problem and lead you to a solution!
    George
    Home | Blog

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    ..or even a route comprises many stops
    ..many routes may use one stop
    ..many buses may service one route
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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