Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2008

    Unanswered: reservation database


    I have a query I could use some clarification on just to make sure my understanding is correct so thanks in advance for any responses.

    I need to create a reservation / availibility database for a number of units which I think will take the following form

    Reservation Number - Identity Column
    Unit ID - Unique ID String (Foreign Key)
    Reservation Start Date - DateTime
    Reservation End Date - DateTime

    I will be performing the following queries on:

    1. Retrieve all Reservation Start and End Dates for each Unit ID
    2. Retrive all Unit ID that do not have a reservation for a user specified date range.

    Can somebody let me know if my table design is the most efficient way to store the data to perform the queries I require?

    The only alternative I can think of is to have a table with a field for each day where a reservation can be made (e.g 365 / year) instead of having a reservation start date and reservation end date.

    This second method the table will be much larger than it probably needs to be but will the query results be performed faster / more efficiently???

    Hope this is clear enough for an answer.


  2. #2
    Join Date
    Nov 2004
    on the wrong server
    Provided Answers: 6
    is this the final exam or is class just starting?
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Jul 2003
    San Antonio, TX

    it must be a make-up summer crash course
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  4. #4
    Join Date
    Aug 2008
    neither...thanks for your comments though! Anybody got anything constructiive to say?

    Even just a one liner to point me on the right track. I've searched a plenty to find an answer to this question. but have seen nothing that reassures me about how to proceed.

    I am a novice (as is apparently obvious) so would appreciate any guidance. This is what these forums are for after all , right?

  5. #5
    Join Date
    Jan 2007
    Provided Answers: 12
    The best way is for you to knock up a quick example of your table, populate it with sample data and then try and write the queries yourself.

    You can even post your attempts back here for critique and further suggestions
    Home | Blog

  6. #6
    Join Date
    Apr 2002
    Toronto, Canada
    your table design is fine, it's way better than the other one you were thinking of ("a table with a field for each day where a reservation can be made (e.g 365 / year)")

    you don't actually need Reservation Number - Identity Column but if yo feel more comfortable with it, it's not too bad | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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