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

  • Home
  • SEARCH
  • 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 7827867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:04:32+00:00 2026-06-02T10:04:32+00:00

I have the following table where teachers class routine are stored Table Name: batchroutine_regular

  • 0

I have the following table where teachers class routine are stored

Table Name: batchroutine_regular

batchid class_day   subject    teacherid class_start   class_end
   1     Sunday     English-1    1001     02:00 PM     03:30 PM
   1     Sunday     Geography    1002     04:00 PM     05:30 PM
   2     Monday     Math         1001     10:00 AM     12:30 PM
   2     Tuesday    Geography    1001     01:00 PM     03:30 PM

Now lets say you are the teacher whose teacherid is 1001. You are asked to take a class on Monday which will start at 11:00 AM and end at 1:00 PM. Now my question is what would be the MYSQL/PHP query to find out if you are available at that time, from the table batchroutine_regular?

Thanks in Advance 🙂

  • 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-06-02T10:04:33+00:00Added an answer on June 2, 2026 at 10:04 am
    SELECT (COUNT(*) = 0) AS Available
    FROM batchroutine_regular
    WHERE
          teacherid = 1001
      AND class_day = 'Sunday'
      AND (
           (class_start <= MAKETIME(11,00,00) AND class_end >= MAKETIME(11,00,00))
        OR (class_start <= MAKETIME(13,00,00) AND class_end >= MAKETIME(13,00,00))
      )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following table Managers (simplified): ID, int Name, nvarchar(100) In a stored procedure
I have following table (SQL Server) Table name is LandParcels Blockid ParcelNo Stateorprivate ========================
I have following table structure: CREATE TABLE pilot_groups ( id INT PK, name VARCHAR(50),
I have following table structure ID Name Parent_ID 1 abc 0 2 efg 1
I have following table. <form method=post action=test.php> <input name=id[] type=text value=ID1 /> <input name=value[]
I have following table structure in my DB ID Name -------------------------- ID_1 Name1 ID1
i have following table album_id | sub_album_id | name sdf2342 | 0 | family
I have following table: FOLDER[ id int, name varchar2(10), parent_folder_id int ] I would
I have the following table with two columns ID Name 1 ABC 2 Acc
I have following table structure table domains ID | name | ________________________ 1 |

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.