Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Project Assignment DAM

Last Date of Submission: 2 July 2021

Database Schema

Student (RegNo, firstName, lastName, DOB, Gender, City, PhoneNo, CGPA, admission_session)

Teacher (Emp_id, firstName, lastName, DOB, Last_Education, Last_Institute, Major_Sub, Gender,


Designation)

Course (course_Code, course_Name, credit_hours, Semester, Type)

Enrollment (RegNo, course_code, Emp_id, session, Quality_Points, Grade)

Note:

- For Student table


o RegNo must be “YYYY-ARID-****”. “*” means any number.
o DOB is date of birth, student less than 18 years must not be added.
o CGPA must be between 0.0 and 4.0.
o Admission_session are names of semester which can be “Fall-YY” or “Spring-YY”. YY
means year in two digits. Example (Fall-21 or Spring 20)
- For Teacher table
o Emp_id will be CNIC of user in proper format.
o DOB is date of birth, student less than 18 years must not be added.
o Last_Education means last degree name. like BSCS, MSCS, BA, PhD etc.
o Major_Sub will be name of subject studied in last education like “Computer Science,
English, Mathematics, Islamiat, Electronics etc”
o Designation can be “Lecturer, Asst. Prof, Prof
- For Course Table
o Semester means in which semester this subject must be taught.
o Type can be “CS, IT, Eng, Maths, Electronics”
- For Enrollment Table
o Session means semester in which student has enrolled it. It can be from 1 to 8.
o Quality_points can vary with respect to credit_hours of course.
▪ 1 credit_hour course has maximum 4 Qps
▪ 2 credit_hour course has maximum 8 Qps
▪ 3 credit_hour course has maximum 12 Qps
▪ 4 credit_hour course has maximum 16 Qps
o Grade is dependent upon Quality_Points.
Do as Directed:

1- Write queries to create above tables.


2- Write insert queries to insert data into each table. You must insert 5 students, 5 teachers, 10
courses, and 4 enrolled courses for each student.
3- Create four (4) stored procedures to insert data into each table by taking argument. You must
make sure none of the above mentioned rules are violated. Also ensure primary foreign keys
using stored procedures.
NOTE: do not insert Quality_Points and Grade into enrollment table.
4- Write a stored procedure which takes RegNo of a student as argument, and display all of its
enrolled courses.
5- Write a mechanism which stops the update process in Enrollment table. Check the values which
are being updated. Update data if and only if QPS and grade are correct.
for example: a course having 2 credit hours cannot have 10 Quality_Points. Or a course having 3
credit_hours having 10 QPS will have A Grade but credit_hours 4 course will have “B” grade on
10 Quality_Points.
6- Create a Table “Backup_Enrollment” which will be exactly same as “Enrollment” table. You must
create triggers for insert, update and delete.
a. When data is inserted into Enrollment table, same data must be inserted into
Backup_Enrollment table.
b. When data is updated into Enrollment table, same data must be updated into
Backup_Enrollment table.
c. When data is deleted into Enrollment table, same data must be deleted into
Backup_Enrollment table.
7- Write a code that reads enrollment table row by row using cursors. Display total QPS of each
student enrolled along with name of student and RegNo. You must not use Aggregate function.

x--------------------------------------------x

You might also like