diff --git a/STINK_student_records.xml b/STINK_student_records.xml deleted file mode 100644 index 6268591..0000000 --- a/STINK_student_records.xml +++ /dev/null @@ -1,738 +0,0 @@ - - - - -
- - System specification and details - -

The Southern Technical Institute for Natural Knowledge is a medium-sized tertiary education provider (founded in 1982) that teaches papers across many subjects, which lead to several different qualifications. They are currently in the process of designing and implementing a new student records database. The requirements analysis phase of the project is complete, and you have been brought in as lead database developer. It will be your task to implement an initial prototype of the database specification resulting from the requirements analysis phase. An ERD of the proposed database is shown in , and more detailed specifications of the database requirements may be found in the following sections.

- - -
- ERD of the proposed database (Barker notation) - - ERD of the proposed database (Barker notation) - -
- - -
- - The <tt>Qualification</tt> entity - - - - - - - - - - - - Column - Description - - - - - Abbreviation - Up to 10 characters - - - * - Full_Name - Up to 100 characters - - - * - Type - (see below) - - - - - - - - The abbreviation is a short string that identifies the qualification, e.g., “BCom”, “PGDipCApSc” (these are not the only possible values). - - The qualification type must be one of the following: “Degree”, “Diploma” or “Certificate”. - - - - - - -CREATE TABLE Qualification -( Abbreviation VARCHAR2(10), - Full_Name VARCHAR2(100) NOT NULL, - Type VARCHAR2(11) NOT NULL - CONSTRAINT Qualification_Type_Valid - CHECK ( Type IN ( 'Degree', 'Diploma', 'Certificate' ) ), - -- - CONSTRAINT Qualification_PK PRIMARY KEY ( Abbreviation ) -); - - -

If we wanted to allow for additional qualification types in future, we could create a separate Qualification_Type lookup table, with a single column Type. We could then replace the CHECK constraint Qualification_Type_Valid with a foreign key to the lookup table. If we use the existing values, this can even be done without breaking the specification.

- -
- -
- - -
- - The <tt>Paper</tt> entity - - - - - - - - - - - - Column - Description - - - - - Paper_Code - 7 characters - - - * - Title - Up to 50 characters - - - * - Description - Up to 500 characters - - - * - Points - Whole number 0–36, default 18 - - - * - Period - (see below) - - - - - - - - - - The paper code comprises a four-letter subject code (e.g., “INFO”) followed by a three digit course number (e.g., “214”). - - The period must be one of the following: “SS”, “S1”, “S2” or “FY” (representing Summer School, Semester One, Semester Two and Full Year, respectively). - - - - - - -CREATE TABLE Paper -( Paper_Code CHAR(7), - Title VARCHAR2(50) NOT NULL, - Description VARCHAR2(500) NOT NULL, - Points NUMBER(2) DEFAULT 18 NOT NULL - CONSTRAINT Paper_Points_Range CHECK ( Points BETWEEN 0 AND 36 ), - Period CHAR(2) NOT NULL - CONSTRAINT Paper_Period_Valid - CHECK ( Period IN ( 'S1', 'S2', 'SS', 'FY' ) ), - -- - CONSTRAINT Paper_PK PRIMARY KEY ( Paper_Code ) -); - - - - -
- - -
- - The <tt>Schedule</tt> entity - -

The Schedule entity exists only to associate Qualification with Paper and thus has no additional attributes beyond its primary key attributes.

- - - - -CREATE TABLE Schedule -( Abbreviation VARCHAR2(10), - Paper_Code CHAR(7), - -- - CONSTRAINT Schedule_PK PRIMARY KEY ( Abbreviation, Paper_Code ), - CONSTRAINT Schedule_FK_to_Qualification - FOREIGN KEY ( Abbreviation ) REFERENCES Qualification, - CONSTRAINT Schedule_FK_to_Paper FOREIGN KEY ( Paper_Code ) REFERENCES Paper -); - - - - -
- - -
- - The <tt>Person</tt>, <tt>Staff</tt> and <tt>Student</tt> entities - - - - - - - - - - Person - - - - - Column - Description - - - - - Person_ID - Internally generated 7 digit identifier - - - * - Surname - Up to 50 characters - - - * - Other_Names - Up to 50 characters - - - o - Contact_Phone - (see below) - - - * - Contact_Address - Up to 200 characters - - - * - Email - Up to 50 characters - - - * - Username - Up to 10 characters - - - - - - - - Staff - - - - - Column - Description - - - - - Staff_ID - 7 digit identifier - - - * - Rank - (see below) - - - * - Salary - Money, 40450.00 - - - - - - - - Student - - - - - Column - Description - - - - - Student_ID - 7 digit identifier - - - o - Home_Phone - (see below) - - - * - Home_Address - Up to 200 characters - - - * - International - True/false, default false - - - - - - - - - - Staff and Student are subtypes of Person, and thus share primary key values. - - Contact phone numbers must cater for full New Zealand landline and mobile numbers. Students’ home phone numbers must cater for full international numbers, as many students are from overseas. - - A staff member’s rank must be one of the following: “T”, “AL”, “L”, “SL”, “AP” or “P” (representing Tutor, Assistant Lecturer, Lecturer, Senior Lecturer, Associate Professor and Professor, respectively). Salaries for senior positions exceed 100000. - - - - - - -CREATE TABLE Person -( Person_ID NUMBER(7), - Surname VARCHAR2(50) NOT NULL, - Other_Names VARCHAR2(50) NOT NULL, - Contact_Phone VARCHAR2(11), -- at least 11, maybe more - Contact_Address VARCHAR2(200) NOT NULL, - Username VARCHAR2(50) NOT NULL - CONSTRAINT Person_Username_Unique UNIQUE, -- bonus marks! - -- - CONSTRAINT Person_PK PRIMARY KEY ( Person_ID ) -); - -CREATE TABLE Staff -( Staff_ID NUMBER(7), - Rank VARCHAR2(2) NOT NULL - CONSTRAINT Staff Rank_Valid - CHECK ( Rank IN ( 'AL', 'L', 'SL', 'AP', 'P' ) ), - Salary NUMBER(8,2) NOT NULL - CONSTRAINT Staff_Salary_Range CHECK ( Salary >= 40450 ), - -- - CONSTRAINT Staff_PK PRIMARY KEY ( Staff_ID ), - CONSTRAINT Staff_FK_to_Person - FOREIGN KEY ( Staff_ID ) REFERENCES Person ( Person_ID ) -); - -CREATE TABLE Student -( Student_ID NUMBER(7), - Home_Phone VARCHAR2(15), -- ITU Recommendation E.164 - Home_Address VARCHAR2(200) NOT NULL, - International CHAR(1) DEFAULT 'F' NOT NULL - CONSTRAINT Student_International_Valid - CHECK ( International IN ( 'T', 'F' ) ), - Supervisor_ID NUMBER(7), -- optional - -- - CONSTRAINT Student_PK PRIMARY KEY (Student_ID), - CONSTRAINT Student_FK_to_Person - FOREIGN KEY (Student_ID) REFERENCES Person (Person_ID), - CONSTRAINT Student_FK_to_Staff - FOREIGN KEY (Supervisor_ID) REFERENCES Staff (Staff_ID) -); - - -

It’s important when implementing “boolean” style columns such as International in Student and Release in Assessment that you are consistent in the values that you use across all such columns (more precisely, all such columns should have the same domain). Quite a few people did something like implement one column as 'T', 'F' and the other as 'True', 'False', or even more subtle, 't', 'f' (remembering that SQL is case sensitive). Using inconsistent domains for columns that should have the same domain could lead to subtle bugs later on.

- -

This of course is really a consequence of not having a proper BOOLEAN data type in SQL. However, one person did discover—possibly inadvertently, given that it isn’t mentioned anywhere in the documentation—that now supports the use of the BOOLEAN data type in CREATE TABLE! This certainly wasn’t possible in older versions, where BOOLEAN was available in PL/SQL only.

- -
- -
- - -
- - The <tt>Teach</tt> entity - - - - - - - - - - - - Column - Description - - - - - Staff_ID - 7 digit identifier - - - - Paper_Code - 7 characters - - - - Year_Taught - 4 digits - - - * - Role - (see below) - - - - - - - - - - The teaching year cannot be earlier than the year that the Institute was founded. (Technically it should also not be in the future, but this is surprisingly difficult to check in ! You are welcome to try, but please ensure that you complete the rest of the assignment first.) - - The role must be one of the following: “Coordinator”, “Lecturer” or “Tutor”. - - - - - - -CREATE TABLE Teach -( Staff_ID NUMBER(7), - Paper_Code CHAR(7), - Year_Taught NUMBER(4), - CONSTRAINT Teach_Year_Taught_Range CHECK ( Year_Taught >= 1982 ), - Role VARCHAR2(11) NOT NULL - CONSTRAINT Teach_Role_Valid - CHECK ( Role IN ( 'Coordinator', 'Lecturer', 'Tutor' ) ), - -- - CONSTRAINT Teach_PK PRIMARY KEY ( Staff_ID, Paper_Code, Year_Taught ), - CONSTRAINT Teach_FK_to_Staff FOREIGN KEY ( Staff_ID ) REFERENCES Staff, - CONSTRAINT Teach_FK_to_Paper FOREIGN KEY ( Paper_Code ) REFERENCES Paper -); - - - - -
- - -
- - The <tt>Enrolment</tt> entity - - - - - - - - - - - - Column - Description - - - - - Enrolment_ID - Internally generated 10 digit identifier - - - * - Description - Up to 100 characters - - - * - Year_Enrolled - 4 digits - - - o - Comments - Text (see below) - - - - - - - - - - The enrolment year cannot be earlier than the year that the Institute was founded (nor in the future—see the note above under the Teachentity). - - Comments are used to record details of any issues relating to the enrolment, e.g., a detailed explanation of the reasons for waiving a prerequisite, or a description of how a timetable clash is to be resolved. - - - - - - -CREATE TABLE Enrolment -( Enrolment_ID NUMBER(10), - Description VARCHAR2(100) NOT NULL, - Year_Enrolled NUMBER(4) NOT NULL - CONSTRAINT Enrolment_Year_Enrolled_Range - CHECK (Year_Enrolled >= 1982), - Comments VARCHAR2(4000), -- or CLOB - Student_ID NUMBER(7) NOT NULL, - Paper_Code CHAR(7) NOT NULL, - -- - CONSTRAINT Enrolment_PK PRIMARY KEY ( Enrolment_ID ), - CONSTRAINT Enrolment_FK_to_Student - FOREIGN KEY ( Student_ID ) REFERENCES Student, - CONSTRAINT Enrolment_FK_to_Paper - FOREIGN KEY ( Paper_Code ) REFERENCES Paper -); - - -

A surprising number of people appear to have missed the statement of when the Institute was founded in the first paragraph of the specification!

- -

Another very common error was to set the size of the Comments column to a relatively small number, like 200. Think about how much you can say in that many characters (one and a bit text messages), then consider what kinds of things you might want to enter into a general comments column. We deducted marks for anything smaller than 500 characters. When you have no idea of how much you’re going to get, it’s much better to go large than to go small!

- -
- -
- - -
- - The <tt>Assessment</tt> entity - - - - - - - - - - - - Column - Description - - - - - Assessment_ID - Internally generated 10 digit identifier - - - * - Assessment_Year - 4 digits - - - * - Name - Up to 50 characters - - - o - Description - Up to 500 characters - - - * - Type - (see below) - - - * - Release - True/false, default false - - - * - Weight - 0–100, no decimal places - - - o - Maximum_Mark - (see below) - - - - - - - - - - A new set of assessments is created for each year that a paper is offered. The year cannot be earlier than the year that the Institute was founded (nor in the future—see the note above under the Teachentity). - - The assessment type must be one of the following: “A”, “P”, “T” or “X” (representing assignment, presentation, test and exam, respectively). - - The Maximum_Mark attribute stores the maximum possible raw mark for the assessment (e.g., 30), while the Weight attribute stores the percentage weight of this assessment for the paper as a whole (e.g., 10). If Maximum_Mark is not specified, then front-end applications should use Weight for both. - - The Release attribute controls whether or not the marks for this assessment are accessible by students. - - - - - - -CREATE TABLE Assessment -( Assessment_ID NUMBER(10), - Assessment_Year NUMBER(4) NOT NULL - CONSTRAINT Assessment_Year_Range - CHECK ( Assessment_Year >= 1982 ), - Name VARCHAR2(50) NOT NULL, - Description VARCHAR2(500), - Type CHAR(1) NOT NULL - CONSTRAINT Assessment_Type_Valid - CHECK ( Type IN ( 'A', 'P', 'T', 'X' ) ), - Release CHAR(1) DEFAULT 'F' NOT NULL - CONSTRAINT Assessment_Release_Valid CHECK ( Release IN ( 'T', 'F' ) ), - Weight NUMBER(3) NOT NULL - CONSTRAINT Assessment_Weight_Range CHECK ( Weight BETWEEN 0 AND 100 ), - Maximum_Mark NUMBER(3), - Paper_Code CHAR(7) NOT NULL, - -- - CONSTRAINT Assessment_PK PRIMARY KEY ( Assessment_ID ), - CONSTRAINT Assessment_FK_to_Paper - FOREIGN KEY ( Paper_Code ) REFERENCES Paper -); - - - - -
- - -
- - The <tt>Result</tt> entity - - - - - - - - - - - - Column - Description - - - - - Assessment_ID - 10 digit identifier - - - - Enrolment_ID - 10 digit identifier - - - * - Raw_Mark - 3 digits plus 1 decimal place (i.e., 000.0) - - - * - Weighted_Mark - Floating point - - - * - Percentage_Mark - 0–100, 2 decimal places - - - - - - - - - - The Raw_Mark attribute stores the raw mark awarded for an assessment. Its value should be between zero and the value of Assessment.Maximum_Mark (note that only the lower bound is required for this assignment—bonus marks if you can also implement the upper bound). - - The value of the Weighted_Mark attribute is calculated by the formula: - Raw_Mark / Assessment.Maximum_Mark Assessment.Weight. - - The value of the Percentage_Mark attribute is calculated by the formula: - Raw_Mark / Assessment.Maximum_Mark 100. - - Note that the calculations for Weighted_Mark and Percentage_Mark are not constraints and should not be implemented as such! You may attempt to implement these calculations if you feel confident in your ability to do so, but please ensure that you complete the rest of the assignment first. - - - - - - -CREATE TABLE Result -( Assessment_ID NUMBER(10), - Enrolment_ID NUMBER(10), - Raw_Mark NUMBER(4,1) NOT NULL, - Weighted_Mark NUMBER NOT NULL, - Percentage_Mark NUMBER(5,2) NOT NULL - CONSTRAINT Result_Percentage_Mark_Range - CHECK (Percentage_Mark BETWEEN 0 AND 100), - -- - CONSTRAINT Result_PK PRIMARY KEY ( Assessment_ID, Enrolment_ID ), - CONSTRAINT Result_FK_to_Assessment - FOREIGN KEY ( Assessment_ID ) REFERENCES Assessment, - CONSTRAINT Result_FK_to_Enrolment - FOREIGN KEY ( Enrolment_ID ) REFERENCES Enrolment -); - - -

A lot of people got the sizes of the various NUMBER columns incorrect. Remember that the number of decimal places is included in the total number of digits, not in addition to.

- -

We also accepted FLOAT and BINARY_FLOAT for Weighted_Mark. Anything with a fixed number of decimal places was marked down, as this is a fixed point number, not a floating point number.

- -
- -
- -
- -