SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2006
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    'n' number of possible itinerary items

    If I need to build a list of itineraries within a database, but I am unsure as to the amount of actual itinerary items within the list, how do I go amonst building a table?

    i.e., lets say for one itinerary there is seven stops, but another itinerary has eleven stops. They're all in the same table.

    What would a database achitecture look like for a dynamic amount of stops per each itinerary?

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,347
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by NathanielB View Post
    What would a database achitecture look like for a dynamic amount of stops per each itinerary?
    there would be one table for itineraries, and another table for stops, such that the itinerary of each stop is a foreign key in the stops table

    the 'n' number of possible items would be handled by a variable number of stop rows per itinerary
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Zealot
    Join Date
    Dec 2006
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi r937, thanks for the quick response!

    What would happen if I needed to relate one itinerary (which has a group of stops) to a specific trip code, which is in a trip_details table?

  4. #4
    SitePoint Guru
    Join Date
    Sep 2008
    Posts
    977
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is the trip code unqiue to each itinerary? if so, you code add it as a column in the itinerary table.

    if the trip code relates to more than one itinerary, I would consider treating it in the saem way as r937 suggested you treat 'stops'.

    I am getting a hint that your db may not be fully normalised yet. it might help if you were to post your table structure in case we can help further.

    bazz

  5. #5
    SitePoint Zealot
    Join Date
    Dec 2006
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by IBazz View Post
    Is the trip code unqiue to each itinerary? if so, you code add it as a column in the itinerary table.

    if the trip code relates to more than one itinerary, I would consider treating it in the saem way as r937 suggested you treat 'stops'.

    I am getting a hint that your db may not be fully normalised yet. it might help if you were to post your table structure in case we can help further.

    bazz
    Hi guys, sorry Christmas has been taking time away from me.
    The trip codes will be unique for each itinerary; I'll get a EER Diagram up by tomorrow


Bookmarks

Posting Permissions

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