5.2. Designing the Database

Beginning by making notes of all objects required in the database led to the initial design, which was further normalised to avoid any unnecessary duplication of data and keep it consistent throughout the database. Foreign keys will be used throughout to create meaningful relationships where two tables represent the same column properties. Composite keys will also be used to represent more complex objects in the database. The tables and the columns that make them up can be seen below:

The “Days” table, used to store the days of the week.
The “Dates” table, used to store dates for which attendances can be recorded.
The “Semesters” table, used to organise different dates.
The “Users” table, where information on different users can be stored.
The “Students” table, where different student information can be stored.
The “Periods” table, where the 7 periods of each day can be stored individually (three of which can indicate a double-period where the lesson for students remains the same).
The “Groups” table, used to assign students and thus teacher timetables to particular groups (each teacher can only be teaching one group per period).
The “Lessons” table, where each lesson of the school will be stored to create teacher timetables.
The “Attendances” table, where the register of all timetables will be stored for each period, student and date.
The “Teachings” table, where teacher timetables will be imported to. Each teacher may generate up to 7periods x 5days = 35 rows according to their timetable.
The “Feed” table, used to store all update posts Administrators and Secretaries create through the Desktop Application.

The following script was implemented after finalising the Database Design and can be used to create additional databases functioning as different schools. All the databases can be stored in a singular or multiple SQL Servers which may either be local or on the cloud. To implement the relationships, Microsoft’s SQL Server Management Studio was used for an easier to use GUI experience.

The code above may be used as many times as needed in a singular SQL Server to re-create the same structure multiple times for different schools. The name of each database would have to be altered only, since the solution looks for preset table names like “users” and cannot check for alternatives.

The relationships created for the tables can be represented in the graph below:

Table Relationships

Last updated