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 6379475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:08:35+00:00 2026-05-25T02:08:35+00:00

I am designing a SQL table to store hours of operation for stores. Some

  • 0

I am designing a SQL table to store hours of operation for stores.

Some stores have very simple hours: Monday to Sunday from 9:30AM to 10:00PM

Others are little more complicated. Please consider the following scenario:

Monday:  Open All Day
Tuesday: 7:30AM – 2:30PM & 4:15PM – 11:00 PM 
Wednesday: 7:00PM – 12:30 AM (technically closing on Thursday morning)
Thursday: 9:00AM – 6:00PM
Friday: closed.

How would you design the table(s)?

EDIT

The hours will be used to showing if a store is open at a user selected time.

A different table can probably handle any exceptions, such as holidays.

The store hours will not change from week to week.

  • 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-25T02:08:35+00:00Added an answer on May 25, 2026 at 2:08 am

    A table like this would be easy for both the output you posted, as well as just firing a bit back (open? yes/no):

    Store | Day | Open | Closed
    ---------------------------
    1     | 1   | 0000 | 2400
    1     | 2   | 0730 | 1430
    1     | 2   | 1615 | 2300
    ...
    

    Features:

    1. Using 24-hour isn’t necessary, but makes math easier.
    2. Store ID would presumably join to a lookup table where you stored Store information
    3. Day ID would translate to day of week (1 = Sunday, 2 = Monday, etc.)

    To query for your dataset, just:
    SELECT Day, Open, Close... (you’d want to format Open/Close obviously)

    To query IsOpen?, just:

    SELECT CASE WHEN @desiredtime BETWEEN Open AND Closed THEN 1 ELSE 0 END 
    FROM table 
    WHERE store = @Store
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm designing a table in SQL Server 2008 that will store a list of
I am designing a table in the database which will store log entries from
I am designing a SQL query to extract all records from a given table.
I'm designing my database and LINQ To SQL ASP.NET web application. Imagine I have
Designing a new system from scratch. I'll be using the STL to store lists
I am designing a User table in my database. I have about 30 or
I'm designing a new system, and I have need to store a pretty large
We're designing data import from an external source like MAS200 into our production SQL
I have a quick question - is there a best practice in SQL Table
I am designing my db tables in SQL Server 2005 and have come across

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.