Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7678651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:41:47+00:00 2026-05-31T17:41:47+00:00

Hi am I am creating a database which allows users to make a reservation

  • 0

Hi am I am creating a database which allows users to make a reservation to a restaurant. Below is my data model for the database.

My question is i am a little confused with how i would check for tables that are available on a given night. The restaurant has 15 tables for any night with 4 people to a table (Groups can be 4 – 6 big, groups larger than 4 will take up two tables).

How would i query the database to return the tables which are available on a given night.

Thanks.

EDIT::

This is what i have tried. (Some of it is pseudo as i am not quite sure how to do it)

SELECT tables.table_id
FROM tables
LEFT JOIN table_allocation
ON tables.table_id = table_allocation.table_id
WHERE table_allocation.table_id is NULL;

This returns the well empty rows as it is checking for the none presence of the table. I am not quite sure how i would do the date bit test.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:41:49+00:00Added an answer on May 31, 2026 at 5:41 pm

    To find TABLE rows that have no TABLE_ALLOCATION rows on a given THEMED_NIGHT.TEME_NIGHT_DATE, you should be able to do something like this:

    SELECT *
    FROM TABLES
    WHERE
        TABLE_ID NOT IN (
            SELECT TABLE_ALLOCATION.TABLE_ID
            FROM
                TABLE_ALLOCATION
                JOIN RESERVATION
                    ON TABLE_ALLOCATION.RESERVATION_ID = RESERVATION.RESERVATION_ID
                JOIN THEMED_NIGHT
                    ON RESERVATION.THEME_ID = THEMED_NIGHT.THEME_ID
            WHERE
                THEME_NIGHT_NAME = :the_date
        )
    

    In plain English:

    • Join TABLE_ALLOCATION, RESERVATION and THEMED_NIGHT and accept only those that are on the given date (:the_date).
    • Discard the TABLE rows that are related to the tuples above (NOT IN).
    • Those TABLE rows that remain are free for the night.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a database that will help keep track of which employees have
I am currently creating an iOS app, which connects to a database and asynchronously
I'm creating a database application using ASP.NET and I want to make a Windows
I have a MySQL database which contains a table of users. The primary key
I am creating an web application which allows user to post some article/blog on
Ok so I am creating an API for manipulating users and data in a
I am currently working on a project which allows users to design a small
I am currently creating a database, it allows a user to upload a publication,
When creating database tables I'm often stumped when trying to name my time/date/timestamp fields.
I am creating database at runtime and I want to create the tables in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.