32-ITE-01 Group 2 (SAO)
32-ITE-01 Group 2 (SAO)
List of entities
academic_records
awards
disciplinary_actions (Junction Table of students and violations)
organizations
programs
students
student_grades (Junction Table of academics records and programs)
student_organizations (Junction Table of students and organizations)
violations
Academic records
o Academic records ID – id int(12)
o Student ID – student_id int(12)
o School year from - school_year_from int(12)
o School year to – school_year_to int(12)
o Semester – semester int(12)
o Course – course varchar(50)
Awards
o Award ID – id int(12)
o Student ID – student_id int(12)
o Name – name varchar(50)
o Description – description varchar(255)
o Category – category varchar(50)
o Date awarded – date_awarded datetime
o Awarded by – awarded_by varchar(50)
Disciplinary actions
o Discriplinary action ID – id int(12)
o Student ID – student_id int(12)
o Violation ID – violation_id int(12)
o Resolution – resolution varchar(255)
o Status – status int(1)
o Remark – remark varchar(255)
o Created at – created_at timestamp
o Updated at – updated_at timestamp
Organizations
o Organization ID – id int(12)
o Name – name varchar(50)
o Activities – activities varchar(50)
o Created at – created_at timestamp
o Updated at – updated_at timestamp
Programs
o Program Code – code int(12)
o Description – description varchar(255)
o Unit – unit int(12)
Students
o Students id – id int(12)
o Name – name varchar(50)
o Gender – gender enum('female', 'male', 'other')
o Phone number – phone_number bigint(20)
o Birthdate – birthdate varchar(50)
o Registered at – registered_at timestamp
o Update at – updated_at timestamp
o Is enrolled – is_enrolled tinyint(1)
Student grades
o Student grade ID – id int(12)
o Program code – program_code int(12)
o Academic record ID – academic_record_id int(12)
o Final grade – final_grade int(12)
Student organizations
o Student organization ID – id int(12)
o Student ID – student_id int(12)
o Org ID – org_id int(12)
Violations
o Violation ID – id int(12)
o Name – name varchar(50)
o Description – description varchar(255)
Primary Keys
o id – Academic records Entity
o id – Awards Entity
o id – Disciplinary actions Entity
o id – Organizations Entity
o code – Programs Entity
o id – Students Entity
o id – Student grades Entity
o id – Student organizations Entity
o id – Violations Entity
2. Relationships
Academic Record ID and Program ID foreign keys of the Student Grades entity are
connected to the primary keys of the Academic Records entity and Programs entity
to establish the relationship between the Academic Records entity and Programs
entity.
Student ID, a foreign key of the Academic Records entity, is connected to the
primary key of the Students entity to establish the relationship between the
Students entity and Academic Records entity.
Student ID, a foreign key of the Awards entity, is connected to the primary key of
the Students entity to establish the relationship between the Students entity and
Awards entity.
Student ID and Organization ID foreign keys of the Student Organizations entity
are connected to the primary keys of the Students entity and Organizations entity
to establish the relationship between the Students entity and Organizations entity.
Student ID and Violations ID foreign keys of the Disciplinary Actions entity are
connected to the primary keys of the Students entity and Violations entity to
establish the relationship between the Students entity and Violations entity.
3. ERD Overview
4. SQL Schema
o Disciplinary actions
CREATE TABLE `sao`.`disciplinary_actions` (
`id` INT(12) NOT NULL AUTO_INCREMENT ,
`student_id` INT(12) NOT NULL ,
`violation_id` INT(12) NOT NULL ,
`resolution` VARCHAR(255) NOT NULL ,
`status` INT(1) NOT NULL ,
`remark` VARCHAR(255) NOT NULL ,
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
,
`updated_at` TIMESTAMP NULL ,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
o Organizations
CREATE TABLE `sao`.`organizations` (
`id` INT(12) NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(50) NOT NULL ,
`activities` VARCHAR(50) NOT NULL ,
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
,
`updated_at` TIMESTAMP NULL ,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
o Programs
CREATE TABLE `sao`.`programs` (
`code` INT(12) NOT NULL AUTO_INCREMENT ,
`description` VARCHAR(255) NOT NULL ,
`unit` INT(12) NOT NULL ,
PRIMARY KEY (`code`))
ENGINE = InnoDB;
o Students
CREATE TABLE `sao`.`students` (
`id` INT(12) NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(50) NOT NULL ,
`gender` ENUM("male", "female", "others") NOT NULL ,
`phone_number` BIGINT(20) NOT NULL ,
`birthdate` VARCHAR(50) NOT NULL ,
`registered_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMEST
AMP ,
`update_at` TIMESTAMP NULL ,
`is_enrolled` TINYINT(1) NOT NULL ,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
o Student grades
CREATE TABLE `sao`.`student_grades` (
`id` INT(12) NOT NULL AUTO_INCREMENT ,
`program_code` INT(12) NOT NULL ,
`academic_record_id` INT(12) NOT NULL ,
`final_grade` INT(12) NOT NULL ,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
o Student organizations
CREATE TABLE `sao`.`student_organizations` (
`id` INT(12) NOT NULL AUTO_INCREMENT ,
`student_id` INT(12) NOT NULL ,
`org_id` INT(12) NOT NULL ,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
o Violations
CREATE TABLE `sao`.`violations` (
`id` INT(12) NOT NULL AUTO_INCREMENT ,
`name` VARCHAR(50) NOT NULL ,
`description` VARCHAR(255) NOT NULL ,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
Index Creation
o Last Name from Organizations Entity
ALTER TABLE `organizations` ADD INDEX(`name`);