Restaurant

| restaurant_id | names |

Date

| date_id | date |

Time_slots

| time_slots_id | start_time | end_time | restaurant_id | date_id |

Reservations

| reservation_id | No.of.people | time_slots_id|

Relations between tables:

Relation between time slots and restaurants = Many to Many

Relation between time slots and date = Many to Many

Relation between time slots and reservation = One to one

I will try to structure the restaurant reservation db....in which select restaurant than date after select date the available time slots displayed of selected restaurant on that date...If there is any mistake that i did in this sructure than plz guide me.

Member Avatar for diafol

I can't see dates table working easily. Perhaps having a dates_closed table or something?

slots:

 id | start_time | end_time | day | restaurant_id (FK) | status | created_at | updated_at

reservations:

id | slot_id (FK) | date | booking_name | booking_tel | number_seats | comments | status | created_at | updated_at

restaurants:

id | name | address... | status | covers | created_at | updated_at

dates_closed:

id | restaurant_id (FK) | date | from | to | created_at | updated_at

Many variations possible

thanx for reply...but there is no such date_closed table...i want when sekect restaurant than date...than the available time slots of selected restaurant on that day will appear

Member Avatar for diafol

but there is no such date_closed table

I know, I added it as an example. What I was saying - the inclusion of a separate dates table will make this very much more complicated - far more complicated than needed.

Why do slots have a date attached to them? Surely, these will be the same for a specific day every week?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.