0

How would like to know where can I find examples of sql scripts and tables that learn to set up an apartments holiday with 1 year advanced reservations, with daily and weekly prices, without making a sql table with 732 cells (2 years). I hope a manage to make somebody to understand what I am looking for. There are several well known websites with this type of services. Thanks

1
  • You have the right idea by not wanting a table with 732 columns. If you are new to this sort of thing, I have heard good things about the book Database Design for Mere Mortals. This will teach you the general principles. Then it's up to you to apply it to your own situation.
    – Dan Bracuk
    Mar 10, 2013 at 13:53

1 Answer 1

0

2 tables:

  • appartment { appt_id, appt_name}
  • reservations res_id,appt_id, date_from, date_to}

You just then insert all reservations with the correct appt id. Then, depending on query, you would do a join on both tables. For example to find which dates an appartment id is busy, you would do

  select * from reservations where appt_id=1   

That is obviously assuming you want to query dates for appt 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.