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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:41:46+00:00 2026-05-11T10:41:46+00:00

I am interested in seeing suggestions for a database design regarding business hours. It

  • 0

I am interested in seeing suggestions for a database design regarding business hours.

It would be quite similar to what Facebook has – alt text http://uploader.ws/upload/200903/widget.png

I have a list of businesses, and I would like for users to be able to input multiple sets of available hours for that business. e.g.,

Monday: open 9-5; Tuesday: open 9-12; 1-5; etc. I would not like to be limited to two sets of hours per day. Ideally, N sets of hours per day. If that’s not practical, no more than 4… no less than 2.

I am interested in the ‘best’ (theoretical) and the most practical solutions.

The DBMS I’m using is MySQL.

  • 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. 2026-05-11T10:41:47+00:00Added an answer on May 11, 2026 at 10:41 am

    How about:

    create table business (   id int not null auto_increment primary key,   name varchar(255) );  create table open_hour_range (   id int not null auto_increment primary key,   business_id int,   day_of_week tinyint, /* 0-6 */   open_time time,   close_time time,   foreign key(business_id) references business(id) ); 

    This allows you any combination of hours, including multiple per day. However, it may be a bit slow from a querying perspective, in that you’ll need to do a fair amount of joining to come up with the list of what hours a business is open.

    Also, if you want to be able to display hours in a format like:

    M-F 9-5 Sa-Su 9-12

    You’d need to merge similar ranges in code, outside the database. If you wanted this sort merging, you could change day_of_week to a start_day and an end_day.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Interested if anyone has used VSTS Database Edition extensively and, if so, which features
I am interested in seeing the code where gcc has actually optimized the code.
I'm interested in seeing a good diff algorithm, possibly in Javascript, for rendering a
I am interested in seeing if I can improve the way we use NUnit
I'm interested in seeing what custom extensions other developers have created for the ASP.NET
I'm having trouble getting Spring.Net to log, using Log4Net. I'm particulary interested in seeing
Interested in something similar to JavaScript setTimeout in C on both UNIX and Windows.
I'm interested in learning some (ideally) database agnostic ways of selecting the n th
Although I'm specifically interested in web application information, I would also be somewhat curious
Have any programming methods have been used to defeat reCAPTCHA? I'm interested in seeing

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.