mysql - Optimized SQL for timetable -


I want to create a SQL table in my database which can catch the timetable of the school but by all means I Trying to move forward was not optimal and during the 1-2 changes to the timetable, the database table became a little bigger.

It is a little bit like this:

  mo to mercury guru austerity 07:00 08:00 9:00 10:00 11:00 12:00 13: 00 14:00 15:00 16:00  

The basic layout of this is the timetable and the first 2 columns in the table are timetable and classics. My first approach was to call columns for each day with classes in one column, but it was a small buggy, my next approach was to get columns like mo_7, mo_8, mo_9 etc.

So my question is, what is the most optimal way to save timetables in the database in which table layout.

Thanks in advance.

/ div>

Your problem is not your database, that's because you use it as a spreadsheet Are trying.

You have to leave behind a small shop in the classroom, along with many features. If there is only one session in each class, add 'time' as a feature. If there are many sessions, then it is possible that you have to separate separately from the table separately from time to time.

Example:

Table 'Classes':

  • Class ID.
  • Description
  • Teacher
  • Other Goods.
  • ul>

    And then you select a selection for example Like to use

      SELECT classID, start_time, day, location from where "Monday" by ORDER start_time   

    for you Monday To make it your list, you can join the 'class' table.

      select classes.description, classes.teacher, sessions.start_time, sessions.day, sessions from session session, classes join classes. Classid = session. Class where type 'session' as the 'Monday' order. Start_time  

    There is nothing like this (if the criteria is a bit off, then I can modify / if I can)

    But the issue is - the database Store actual data and use the query to convert to the layout you like. In this way, every time you want to change some minors, you should not have to re-write your database.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -