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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:42:42+00:00 2026-05-17T18:42:42+00:00

I know that it has been told almost anything related to time table modeling

  • 0

I know that it has been told almost anything related to time table modeling in RDBS, but I can not find any well written documentation about available techniques to store time tables in DB.

My case:

  • I have table which holds available places, and table with actual classes.
  • Each place has it’s own unique schedule
  • Each class can be scheduled in any place, and any time, with few exceptions:
    • One class can take one time-slot (Example: If class A is scheduled in place P1 at 12:00 for 1hour duration, next occurrence of class A can only be placed before 12:00 or after 13:00, in any place, which has free time-slot; It’s forbidden to schedule class A in one time in two places)
    • In one place it can be one class with time-slot
  • Model should support versioning/history of scheduled classes

Now, how I can represent this data model in an SQL DB?

I’m not looking ready-to-use exact schema, rather I will be glad if anyone can write available modelling techniques and their comparison, which I can use to solve this task

For example: For tree-structure/hierarchical data, there is well documented “modified preorder tree traversal algorithm”, is there some similar algorithm/technique to deal with time-slots?

  • 1 1 Answer
  • 3 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-17T18:42:42+00:00Added an answer on May 17, 2026 at 6:42 pm

    A timetable is a matrix. Down the left hand side we have LOCATIONS. Across the top we have TIMESLOTS. The intersection of any given permutation of LOCATION and TIMESLOT is a cell with either a CLASS or null.

    To model this we need a table (entity) of LOCATIONS, which is pretty fixed data. We need a table of TIMESLOTS (date/times) which is ever growing. We need a table CLASSES, which is also pretty fixed. Finally we need an intersection table CLASS_TIMESLOT_LOCATIONS. This is where the magic happens. This table has three foreign keys, one to CLASSES, one to LOCATIONS, one to TIMESLOTS. Its primary key is (LOCATION_ID, TIMESLOT_ID) but it also needs a unique constraint on (CLASS_ID, TIMESLOT_ID).


    You are asking a modelling question, but there are a couple of implementation details which you will need to think about. They won’t chnage the logical model but they will affect how you work with the physical tables. The first consideration is whether to spawn all the potential TIMESLOTS, and, if so, how big a window you store. The second is whether to store null entries for the intersection table, CLASS_TIMESLOT_LOCATIONS.

    There are no straightforward answers here: some database products will find it easier to “fill in the gaps” than others. Also, generating the absent records on the fly may be too much of a performance hit, in which case disk space is a good trade-off.


    As for storing history, this is presumably for storing changes to the schedule. Use separate tables for this, populated by triggers (you could use stored procedures but triggers is the industry standard). Don’t be tempted to store history in the main tables. It breaks the normalised model and causes all sorts of grief.

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

Sidebar

Related Questions

I know that UIAppearance has been introduced in iOS 5, but is there any
I know that this has already been asked here but the answer (using a
I know that this sort of question has been asked here before, but still
I know this has been asked before but there is really not a clear
OK, I know that this has been asked previously, so please forgive me for
I know that many threads has been created here & on the internet about
I know that this question has been asked several times and I've read all
Now that Google Earth has been released for Android 2.1, does anyone know what,
It has been suggested that I use CSS for displaying XML. I know in
I know this has been asked before but I needed some clarification and confirmation.

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.