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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:58:15+00:00 2026-05-29T10:58:15+00:00

I have to store the following information into a database, to be used by

  • 0

I have to store the following information into a database, to be used by a .NET assembly. They are representing times that a certain color is active:

RED: 16:30 – 18:30 Mon to Fri Incl Bank Holidays
AMBER: 09:00 – 16:30 & 18:30 – 20:30 Mon to Fri incl Bank Holidays &
16:30 – 18:30 Sat & Sun
GREEN: 00:00 – 09:00 & 20:30 –
24:00 Mon to Fri incl Bank Holidays & 00:00 – 16:30 * 18:30 – 24:00
Sat & Sun

I’ve initially set off with a database schema like so:

Column Name ID Pk Null? Data Type Default Histogram Encryption
Alg Salt

RED_WEEKDAY_START 14 Y NUMBER None
RED_WEEKDAY_END 15 Y NUMBER None
RED_WEEKEND_START 16 Y NUMBER None
RED_WEEKEND_END 17 Y NUMBER None
AMBER_WEEKDAY_START 18 Y NUMBER None
AMBER_WEEKDAY_END 19 Y NUMBER None
AMBER_WEEKEND_START 20 Y NUMBER None
AMBER_WEEKEND_END 21 Y NUMBER None
GREEN_WEEKDAY_START 22 Y NUMBER None
GREEN_WEEKDAY_END 23 Y NUMBER None
GREEN_WEEKEND_START 24 Y NUMBER None
GREEN_WEEKEND_END 25 Y NUMBER None

However a couple of problems with this:

  • Doesn’t deal with bank holidays (at all)
  • Only allows one period of time for each colour (for example green being split up on weekdays)

So what would be a better way to go about storing this kind of data?

  • 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-29T10:58:16+00:00Added an answer on May 29, 2026 at 10:58 am

    Five Columns

    Colour | Day | StartTime | EndTime | AppliesOnBankHolidays
    

    (RED: 16:30 – 18:30 Mon to Fri Incl Bank Holidays) translates to

    RED|Mon|16:00|18:30|True
    RED|Tue|16:00|18:30|True
    RED|Wed|16:00|18:30|True
    RED|Thu|16:00|18:30|True
    RED|Fri|16:00|18:30|True
    

    AMBER: 09:00 – 16:30 & 18:30 – 20:30 Mon to Fri incl Bank Holidays & 16:30 – 18:30 Sat & Sun translates to

    AMBER|Mon|09:00|16:30|True
    AMBER|Tue|09:00|16:30|True
    AMBER|Wed|09:00|16:30|True
    AMBER|Thu|09:00|16:30|True
    AMBER|Fri|09:00|16:30|True
    AMBER|Mon|18:30|20:30|True
    AMBER|Tue|18:30|20:30|True
    AMBER|Wed|18:30|20:30|True
    AMBER|Thu|18:30|20:30|True
    AMBER|Fri|18:30|20:30|True
    AMBER|Sat|16:30|18:30|False
    AMBER|Sun|16:30|18:30|False
    

    And I’ll leave the third line as an exercise!

    Feel free to normalise dates and colours if you really want to save on space. The Bank holiday question requires another table of bank holidays which you can join to in any query you use:

    PSEUDO SQL

    SELECT t.Colour, t.StartTime, t.EndTime
    FROM Times t 
    WHERE Day(Today)==t.Day AND NOT (t.AppliesOnBankHolidays==FALSE AND IsBankHoliday(Today)) 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Did you ever have the following situation: you need to store information, but a
I have the following objective C class. It is to store information on a
I have a database which stores (among other things), the following pieces of information:
I have a database that is filled with information for films, which is (in
I am trying to store recurrence event information into a database. I want to
I have the following array I want to store in my database... $insData =
We have a paid app on the App Store with id following the lines
I have the following table called stores id store zip 1 Market 1 01569
I have following small script to preview some text before submitting it to store
I have the following view controller in my UIPopover: @protocol StorePopoverDelegate - (void)storeSelected:(NSString *)store;

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.