Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2008

    Unanswered: easy design question

    We want to design a system to let users share cars and are thinking of using this

    users(id, email)
    cars(id, title)
    reservations(user_id, car_id, start_time, end_time)
    Any thoughts on whether a table design like this is smart and if we'll run into problems later if we have many users or cars? The system will need to let users search available cars in a certain time slot quickly.

    Cars can only be reserved in half hour chunks in case this information can be used for a smarter db design. Thanks for any feedback.

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    that'll work just fine

    make sure that start_time and end_time actually contain datetimes, not just times | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jun 2009
    The design itself should be ok, assuming more columns or tables with more details will be added.

    e.g.: If you get more and more cars, they might get the same title,
    or users could have the same email address (family situation where husband or wife both use the system).
    The id (assuming it's a serial) will not give you the information you need if two cars with the same title are standing next to eachother.

    Also, the locations where the cars are picked up or are left behind could be usefull, maybe cell phone numbers if the guy driving the car before you is late, you can find out if he's going to be WAAAY late or just a few minutes.
    etc ...

Posting Permissions

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