r/SQL • u/imitationgamer • Jun 19 '19
PostgreSQL Store student timetables in PostgreSQL
For a project I'm working on, I need to store the course timetables of the students in my college in a PostgreSQL database (this is not my decision).
Some Background:
- College has around 3000 students and due to the freedom in course selection, we might as well as assume each student might have a unique course list.
- We have names for certain slots (let's say for example, Weekdays 9AM-10AM is slot A). Most courses follow these slots, but others have custom timings with classes of variable lengths of time.
- While it is uncommon, some courses have two classes on the same day. By class, I mean a single continuous chunk of time a student has to be present in the classroom.
- I will also have to store the course's start and end dates.
My ideas:
A table for the schedule of all courses and tables listing courses for each student.
- One hack for storing the course schedule for a week was to split it into half an hour intervals and store a string with binary values of whether a class is there in that period.
- Another way of storing the course schedule was to have a Day Start Time and Day End Time for each day. To work around have multiple classes on the same day, have Day Start Time 1, etc.
I see both the methods as hacky and was hoping someone could suggest a schema (or give me hints/resources to learn making one my own). It would be really nice if it used the built-in types in the database instead of parsing through strings.
I'm new to working with a SQL database and relatively new to Development, so my apologies if I have missed anything. I'm also not sure if a support request such as this is allowed here, but I couldn't find anything describing a solution I can adapt elsewhere and do not know where else I can ask.
Thank you.
View all comments
Show parent comment
1
u/da_chicken Jun 19 '19
MS SQL Server, the only one our student information system (SIS) vendor supports.
Bear in mind that these are the engines I've seen supported on SISs:
Yeah, I have no idea why so many SISs are using flat file storage in the 2010s. Last I heard one of the companies was just now releasing a new version and the major feature was "using a relational database system." As a new feature for 2020!
I've only worked on three different SIS systems directly, but, believe it or not, the system that used PostgreSQL was actually the worst design of the bunch. The DB was okay (and the engine is great), but it was the only instance of possible over-normalization I've ever seen. Not for performance issues; the database was just incomprehensible. It wasn't quite as bad as having a different table each for a student's first, middle, and last name, but it wasn't far removed. More than once you had to worm through a series of two or more junction tables just to get to all your data, and the table names would be like "srscnvux". They literally did not allow table names longer than 10 characters, and there were probably over 2,000 tables in the system. It was often impossible to tell if data were missing or if something was configured incorrectly or if you had had a wrong table or needed an outer join, etc. And of course the data definition documentation was way out of date.
Worse, the interface didn't present information logically. Even the most trivial search could output duplicate rows and that confused users. There was also no system to mass update students or classes or anything (probably because the ORM couldn't handle it). Almost everything apart from promoting students at end of year was one at a time. Security was also far too granular. There were roughly 800 separate permission settings that could be configured in about 4 different ways each, and we didn't have all the available modules they offered. Permissions could be set on groups or directly on the users. And the security screen was one gigantic list of settings for each group or user.