mb_96
mb_96

Reputation: 147

store data on basis of date and time - Reservation system

I am making a restaurant table reservation project where a customer can book a particular table (according to where table is placed in restaurant).

What I thought -

A table bean(table's class) with attributes - id, isReserved(boolean) - to get which tables are not reserved yet. This bean class corresponds to a 'tables' relation in db. 'tables' will have 20 records(20 different tables with different locations).

Then there is a customer class which corresponds to customer table in db. Customer will be stored when he makes a reservation. Attributes - id, email, contact, reservedTable_id.

But now I think all this is useless because a customer books a table according to a date and time. Everytime he looks for a table on a different date, it should have 'isReserved' entry for that date. So, does that means I should limit the days for reservation(eg 10) and create 10 'tables' tables, 1 for each day. But still how will time be adjusted like for eg a table can be booked multiple times in a day.

I am really confused and I think I am missing something(or some concepts) or my approach to problem is not correct. I have googled this date and time problem but I am not clear at all. If I am missing something, I am ready to read those concepts if someone guides me. Please help.

Upvotes: 0

Views: 1278

Answers (1)

Ikyong
Ikyong

Reputation: 98

Here some idea, hope it helps. Create 3 Tables (Database Table):

  1. Tables (Dinning Table)
  2. Customer
  3. Reservation

The 3rd table will hold the table_id, customer_id, reservation_date, reservation_hour columns.

Column Description:

  • table_id => PK of table 1
  • customer_id => PK of table 2
  • reservation_date => date of reservation
  • reservation_hour => specific time within the reservation date

Upvotes: 1

Related Questions