+ All Categories
Home > Documents > University Database Management System

University Database Management System

Date post: 14-Sep-2015
Category:
Upload: pandyakavi
View: 29 times
Download: 1 times
Share this document with a friend
Description:
University Database Management System creates, manages and performs all the activities related to the database of a given university. The database consists of information about the university, colleges, students, faculties, academic and research programs. The main aim of this project is to manage the database in such a way that information about academic and research activities can be retrieved easily, efficiently and accurately.Languages : Backend-SQL(MySQL) , Frontend-Java
Popular Tags:
34
University Database Management System 2015 Semester: 4 Course: Database Management System Project: University Database Management System (Academics and Research) Team Members: Kavi Pandya (131020): [email protected] Mayank Jobanputra (131026): [email protected] Urvika Sonar (131060): [email protected] Preksha Chavda (121036): [email protected] 1
Transcript

University Database Management System

6University Database Management System

7University Database Management System

2015Semester: 4

Course: Database Management System

Project: University Database Management System (Academics and Research)

Team Members:Kavi Pandya (131020): [email protected] Jobanputra (131026): [email protected] Sonar (131060): [email protected] Chavda (121036): [email protected]

Contents:

1. Problem Statement2. Project Description3. List of Entities4. Normalization of forms5. Relational Database Schema6. List of Queries7. Database Programming:a. Stored Procedureb. Triggers c. Java Connectivity8. References

1. Problem Statement:

University Database Management System creates, manages and performs all the activities related to the database of a given university. The database consists of information about the university, colleges, students, faculties, academic and research programs. The main aim of this project is to manage the database in such a way that information about academic and research activities can be retrieved easily, efficiently and accurately.

2. Project Description:

A university has different institutes affiliated with it. These institutes have various programs that offer degrees in different departments. Students and faculties of these institutes are associated with different academic and research programs.

Student enrolls for a particular program in a particular department. This program consists of various courses. Experienced faculties teach these courses. Some of these faculty members are permanent while some are visiting. These courses have predefined course structure that includes lectures, projects, assignments, quizzes and exams for which students have to appear and are evaluated throughout the semester. Teaching assistants and associates are appointed for various courses that work under the guidance of the respective faculties teaching that particular course.

As the institute follows unique project based approach student takes various research projects apart from the academic projects and are mentored by the faculties. Seminars, talks and workshops are held for academic and research purposes.

Faculties are also associated with different research projects. Research staff accompanies these faculties that consists of students, teaching assistants and associates and other faculty members if any. Different organizations and the university itself fund these research projects. Such research projects have defined time frame. Many papers are published for these research projects. Successful projects are further applied for patents.

3. List of Entities:

1. Assignment_Course_structure2. Assignments3. Assignments_has_TA4. Author_Faculty5. Author_Student6. Class7. Course_type8. Courses9. Courses_has_Course_type10. Courses_has_Department11. Courses_has_Topics12. Department13. Department_has_Faculty14. Department_has_Program15. Exams16. Exams_has_course_structure17. Faculty18. Faculty_has_course_structures19. Funding20. Grade_Points21. Grades22. Internal_Project_has_TA23. Mentor_has_Research_Topics24. Offerings_Semester25. Offerings_Semester_has_Courses26. Paper27. Paper_has_Author28. Patents29. Prerequisites30. Program31. Project32. Project_has_Student33. Project_has_Topics34. Quiz_of_courses35. Quizzes36. Research_Projects37. Research_Projects_has_Faculty38. Research_Projects_has_Funding39. Research_Projects_has_Paper40. Research_Projects_has_Research_Topics41. Research_Projects_has_Student42. Research_Topics43. Section44. Section_has_course_structures45. Semester46. Seminars47. Seminars_has_Mentor48. Status49. Structure_Course50. Structure_Course_has_Topics51. Student52. Student_has_Assignments53. Student_has_Exams54. Student_has_Quizzes55. Student_has_Section_has_course_structures56. TA_has_Offerings_Semester57. Teaching_Assistants58. Teaching_Associates59. Time_Schedule60. Topics61. Visiting_mentor62. Workshops63. Workshops_has_Class64. Workshops_has_Mentor65. Workshops_has_Research_Topics

4. Normalization of forms:

It may be possible that in database there are tables created which has repetitive data and several anomalies, which can cause inconsistency of data. Normalization is applied to solve this problem. It helps in solving below listed points:

1. Removing Redundancy:

For example,a. Funding table containsinformation only about the funding organizations. It does not include the research projects that are funded by these organizations. Information, about which organization is funding which project, is kept in a separate table. It is done so because it may be possible that an organization may be funding more than one research projects and keeping both these columns in the same table would have resulted in redundant data, so to avoid this problem normalization is applied and tables are separated.b. Department table contains information about the departments of the institute. Program table contains information regarding the programs offered in different departments. Both of these tables are kept separate because many departments have same programs being offered and keeping them in the same table would have resulted in redundant data. Thus, normalization is applied and tables are separated and a table named department_has_program is created which links both of these tables and gives the required information.

2. Avoiding Null Values:Faculty table contains information about the faculties. Research_Topics table contains information about the research topics that are currently being worked on or are completed. These two table are kept separate because it may be possible that some of the faculty members are not working on any research projects and keeping both of these in same table would have resulted in null values in some of the entries. So to avoid this problem, normalization is applied and tables are separated and a table named Research_Projects_has_Faculty is created both of above mentioned tables and gives information.3. Update Anomali:

Courses table consists of information regarding the courses that are offered. Offering_Semesters table contains information about offering time of a particular semester. It may happen that a course was offered in some different semester earlier and presently it is being offered in some another semester. Keeping this data in same table would result in update anomali because while updating, past data would be lost from the records because of the semester change in the offereing of a particular course. So to avoid this update anomaly, normalization is applied and a table named Offerings_semester_has_courses is created which keeps record of each and every course offering time.4. Loss of data when deleting:

Structure_Course table contains information about the course structure of a particular course. Topics table contains information about all the topics taught. If both of these are kept in one table and if assumption is made that a particular topics was included in one of the course structure earlier and removed now then it will lead to loss of record of that topic from that table resulting in delete anomali, so to avoid that, normalization is applied and a table named Structure_Course_has_Topics is created which links above mentioned tables so that no data is lost and required information is retrieved.

5. Relational Database Schema- Add machine generated Line Code here

6. List of Queries:

I. FIND STUDENT NAME GIVEN FOLLOWING CONSTRAINTS ON ATTENDANCE>7, QUIZ>7, ASSIGNMENT>15, PROJECT>43, MID-EXAM>30 AND FINAL EXAM>35

select first_name, middle_name, last_name, student_id from studentwhere student_id in

(select distinct student_id from student_section_course_structwhere course_section_id=1andattendence > 7and student_id in

(select distinct student_id from student_quizwhere quiz_id=(select quiz_id from course_quiz where course_section_id=1)andmarks > 7) and student_id in

(select distinct student_id from student_assignmentswhere assignment_id=(select assignment_id from assignment_course_structure where course_section_id=1)and marks > 15) and student_id in

(select distinct student_id from project_has_studentwhere internal_project_id=(select project_id from project where course_section_id=1)and marks > 43) and student_id in(select distinct student_id from student_examswhere exam_id=(select exam_id from exams where exam_id in (select exam_id from exam_course_structure where course_section_id=1) and exam_type='MID')and marks > 30) and student_id in

(select distinct student_id from student_examswhere exam_id=(select exam_id from exams where exam_id in (select exam_id from exam_course_structure where course_section_id=1) and exam_type='FINAL')and marks > 35)

)

II. List of all the course_structure_id and name that are being offered currently.

select course_structure_id, course_id from course_structure where course_structure_id in (select distinct course_structure_id from section_course_structure where course_section_id in (select course_section_id from student_section_course_struct where status_id = 'C')) order by course_structure_id;

III. Average marks of students within given quiz_id. Here given quiz_id is taken as 1

select sum(marks)/count(student_id) as 'Average Quiz Marks' , total_marks as 'Total Quiz Marks'from student_quiz,quizzes where student_quiz.quiz_id=1 and quizzes.quiz_id=1;

IV. Student getting highest marks in give assignment

set @highest_marks=(select marks from student_assignments where assignment_id=1 order by marks desc limit 1,1);

select first_name, middle_name, last_name, student_id from student where student_id in(select student_id from student_assignments where assignment_id=1 and marks=@highest_marks);

V. Research projects having maximum number of students

set @max_stud=(select count(research_id) from research_project_student group by research_id order by count(research_id) desc limit 1,1);

select * from research_projects where research_id in (select research_id from research_project_student group by research_id having count(research_id)=@max_stud);select @max_stud;

VI. Give list of total funding of all research projects

VII. List of projects headed by given TA

select Project_Title,Internal_Project_ID from project_topics where internal_project_id in ( select Internal_Project_ID from ta_internal_projectwhere ta_id in (select TA_ID from ta_sem_offering where TA_Roll in (select TA_ID from teaching_assistants where Faculty_ID = (select Faculty_ID from faculty where Name='Jaina Mehta'))));

VIII. Student With highest attendance in the given course

set @max_attendence= (select attendence from student_section_course_struct where course_section_id=5 order by attendence desc limit 0,1);

select * from student where Student_ID in(select distinct student_id from student_section_course_structwhere course_section_id=5andattendence = @max_attendence);

IX. Average Attendance(in %age) of the Student in all the courses he has taken so far

set @total_attendance=(select count(*) from student_section_course_struct where student_Id='1301001A01')*10;set @gained_attendance=(select sum(attendence) from student_section_course_struct where student_Id='1301001A01');

set @average_attendance=@gained_attendance*100/@total_attendance;

select @average_attendance as 'Average Attendance(%age)';

X. Average Attendance of all the students in a given course:

set @total_attendance=(select count(*) from student_section_course_struct where course_section_id=1)*10;set @gained_attendance=(select sum(Attendence) from student_section_course_struct where course_section_id=1);

set @average_attendance=@gained_attendance*100/@total_attendance;

select @average_attendance as 'Average Attendance(%age)';

XI. List of Courses Studied by a given studentselect course_structure_id,courses.course_id, course_name,credits,lecture_no from course_structure,courseswhere course_structure_id in(select course_structure_id from section_course_structure where course_section_id in(select course_section_id from student_section_course_struct where student_id='1301001A01')) and courses.course_id=course_structure.course_id order by course_structure_id;

XII. List of Courses ordered by their credits and lectures.

select course_structure_id,courses.course_id,course_name,credits,lecture_no,Attendencefrom courses,course_structure where courses.course_ID=course_structure.course_IDorder by credits desc,lecture_no desc,Attendence desc;

XIII. Average Attendance of students of Students for same course in two different section

set @total_attendance_sect1=(select count(*) from student_section_course_struct where course_section_id=1)*10;set @gained_attendance_sect1=(select sum(Attendence) from student_section_course_struct where course_section_id=1);

set @average_attendance_sect1=@gained_attendance_sect1*100/@total_attendance_sect1;

select @average_attendance_sect1 as 'Average Attendance(%age) of Class in Course Section 1';

set @total_attendance_sect13=(select count(*) from student_section_course_struct where course_section_id=13)*10;set @gained_attendance_sect13=(select sum(Attendence) from student_section_course_struct where course_section_id=13);

set @average_attendance_sect13=@gained_attendance_sect13*100/@total_attendance_sect13;

select @average_attendance_sect13 as 'Average Attendance(%age) of Class in Course Section 13';

XIV. All the courses taught by all visiting faculty:

select course_structure_id,course_id from course_structure where course_structure_id in(select distinct course_structure_id from section_course_structure where course_section_id in(select course_section_id from faculty_course_structure where faculty_id in(select faculty_id from faculty where designation ='Visiting')));

XV. Exam details for a given course_section_id

select * from exams where exam_id in(select exam_id from exam_course_structure where course_section_id=1);

XVI. Name of the courses without any prerequisites requirement

select course_id from courses where course_id not in(select course_id from prerequisites)

XVII. Number of courses within each department

select Department_ID,Department_type,count(Course_id) from course_dept,department where dept_id=department_id group by Department_type;

XVIII. Number of exams conducted in different classes.

select class_ID,count(class_ID) as 'Exams Conducted' from exams group by class_Id;

XIX. Name of the topics that contain Law

select Name from topics where name like '%law%';

XX. select funding_funding_id,max(research_projects_has_funding.amount) from research_projects_has_funding

XXI. Company paying 400000 in funds

XXII. Details of Visiting Faculty

XXIII. Courses having lectures between 18-20

XXIV. Faculty teaching Particular Student

XXV. Getting details about all the firms funding various research projects and their details

XXVI. Matching workshop and research topics table on relationship

XXVII. Funding organizations ISRO has interests in which of the research topics

XXVIII. Funds for game theory projects

XXIX. Workshop with maximum duration is for which research project

XXX. query for retrieving details of faculty taking workshops and also being part of the project

XXXI. query for finding all the students, faculty and TAs in particular research topics and all the faculties mentoring the workshops in that particular research topics

XXXII. Maximum number of assignments for a particular course section ID

XXXIII. Students as student_author

XXXIV. Faculty as faculty_author

XXXV. Maximum marks in which assignment by which studentselect max(student_assignments.Marks),student.Student_ID,Assignment_ID from student,student_assignments where student_assignments.Student_ID=student.Student_ID group by Assignment_ID;

XXXVI. Maximum marks in which examsselect max(student_exams.Marks) as max_marks,student.Student_ID,student_exams.Exam_ID,exam_type from student,student_exams,exams where student_exams.Student_ID=student.Student_ID and exams.Exam_ID=student_exams.Exam_ID group by Exam_ID;

XXXVII. Maximum marks in which quizzes by which studentsselect max(student_quiz.Marks) as max_marks,student.Student_ID,Quiz_ID from student,student_quiz where student_quiz.Student_ID=student.Student_ID group by Quiz_ID;

XXXVIII. Faculties as workshop mentors

XXXIX. Core courses

select courses.Course_ID from courses,courses_has_course_type where courses.Course_ID=courses_has_course_type.Course_ID and courses_has_course_type.Course_type_ID='C';

XL. Information about a particular student attending current courses, faculties those teaching those courses, attendence of student in all those courses:

XLI. Research projects that are completed, funding organizations that funded them, faculties associated with those projects, T.As associated with those projects, faculties that are associated are teaching which courses and student attending those course:

XLII. List of assignments and its link given for currently taught courses by faculties.

XLIII. information about number of students living at particular places:

XLIV. Information about as number of faculties assigned particular designation:

XLV. list of quizzes associated with different courses and TAs associated with them:select distinct q.Quiz_ID, q.Date, q.TA_ID, off.TA_Roll, cq.Course_Section_ID, scs.Course_Structure_ID,cs.Course_ID, c.Course_name

from quizzes q inner join ta_sem_offering off on q.TA_ID = off.TA_ID inner join course_quiz cq on q.Quiz_ID = cq.Quiz_IDinner join section_course_structure scs on cq.Course_Section_ID = scs.Course_Section_IDinner join course_structure cs on scs.Course_Structure_ID = cs.Course_Structure_IDinner join courses c on cs.Course_ID = c.Course_IDwhere q.TA_ID != 0order by q.ta_id

XLVI. Number of workshops for given research topic (name)

select count(Workshop_ID) as 'Number of Workshops' from workshops_research_topic where R_Topic_ID in (select R_Topic_ID from research_topics where title = 'Game Theory');

XLVII. Group faculty in order of the number of classes they take

select faculty.Faculty_ID ,name, count(*) Number_of_classes from faculty_course_structure,faculty where faculty.Faculty_ID=faculty_course_structure.Faculty_Id group by Faculty_ID order by Number_of_Classes desc;

XLVIII. List all course IDs having given topic

select Course_ID,Course_Name,Name Topic_Name from courses,topics where course_id in (select course_id from course_structure where Course_Structure_ID in (select Course_Structure_ID from course_topics where course_topics.Topic_ID = (select Topic_ID from topics where Name = 'Pointers')))and name = 'Pointers';

XLIX. Elective course having maximum student given Section ID

select count(Student_ID) as 'No of Students' from student_section_course_struct where Course_Section_ID in (select Course_Section_ID from section_course_structure where Course_Structure_ID in(select Course_Structure_ID from course_structure where Course_ID in (select Course_ID from course_dept where Elective = 0)) and Section_ID = 1);

L. Given class id give workshop details

select mentor_id,name,existing_organization,workshop_id,title,start_date,end_date from visiting_mentor,workshops_has_mentor,Workshopswhere mentor_id=mentor_mentor_id and Workshops_Workshop_ID=workshop_id and Workshops_Workshop_ID in (select distinct Workshops_Workshop_ID from workshops_has_class where Class_Class_ID=101);

LI. No of Assignments in given course and in given section

select count(*) as No_of_Assignments from assignments natural join assignment_course_structure where Course_Section_ID in (select Course_Section_ID from section_course_structure natural join course_structure where Course_ID = 'CS101' and Section_ID = '1' );

LII. No of Quizzes in given course and in given section

select count(*) as No_of_Quizzes from quizzes natural join course_quiz where Course_Section_ID in (select Course_Section_ID from section_course_structure natural join course_structure where Course_ID = 'CS101' and Section_ID = '1' );

LIII. List of successful research projects

select Research_ID, Title from research_projects where status = 'Completed';

LIV. Schedule of Exams in given course and in given section

select Exam_ID,exam_type,Date,Class_ID from exams natural join exam_course_structure where Course_Section_ID in (select Course_Section_ID from section_course_structure natural join course_structure where Course_ID = 'CS101' and Section_ID = '1' );

LV. Total no of students in university

select count(Student_ID) Total_No_of_Students from dept_student as ds where Department_ID=ds.Department_ID;

7. Database Programming:

a. Stored Procedures

i. Stored procedure 1, for finding out all the quizzes, assignments and exams on a particular date-- ---------------------------------------------------------------------------------- Routine DDL-- Note: comments before and after the routine body will not be stored by the server-- --------------------------------------------------------------------------------DELIMITER $$

CREATE DEFINER=`root`@`localhost` PROCEDURE `reviews_today`(in given_date date)BEGINselect R.Section_ID,R.Course_ID,S.Quiz_ID as review_ID,S.Date,'QUIZ' as type,null as exam_typefrom(select section_course_structure.Section_ID,course_structure.Course_ID,section_course_structure.Course_Section_IDfromcourse_structure, section_course_structurewheresection_course_structure.Course_Structure_ID = course_structure.Course_Structure_ID) as R,(select quizzes.Quiz_ID, quizzes.Date, course_quiz.Course_Section_IDfromquizzes, course_quizwherecourse_quiz.Quiz_ID = quizzes.Quiz_IDand quizzes.Date = given_date) as SwhereR.Course_Section_ID = S.Course_Section_ID union select R.Section_ID,R.Course_ID,S.Exam_ID as review_ID,S.Date,'EXAM' as type,S.exam_type as exam_typefrom(select section_course_structure.Section_ID,course_structure.Course_ID,section_course_structure.Course_Section_IDfromcourse_structure, section_course_structurewheresection_course_structure.Course_Structure_ID = course_structure.Course_Structure_ID) as R,(select exams.Exam_ID,exams.Date,exam_course_structure.Course_Section_ID,exams.exam_typefromexams, exam_course_structurewhereexam_course_structure.Exam_ID = exams.Exam_IDand exams.Date = given_date) as SwhereR.Course_Section_ID = S.Course_Section_ID union select R.Section_ID,R.Course_ID,S.Assignment_ID as review_ID,S.Date,'ASSIGNMENT' as type,null as exam_typefrom(select section_course_structure.Section_ID,course_structure.Course_ID,section_course_structure.Course_Section_IDfromcourse_structure, section_course_structurewheresection_course_structure.Course_Structure_ID = course_structure.Course_Structure_ID) as R,(select assignments.Assignment_ID,assignments.Date,assignment_course_structure.Course_Section_IDfromassignments, assignment_course_structurewhereassignment_course_structure.Assignment_ID = assignments.Assignment_IDand assignments.Date = given_date) as SwhereR.Course_Section_ID = S.Course_Section_ID;

END

OUTPUT

call reviews_today('2013-08-03');

call reviews_today('2013-09-25');

ii. Stored procedure 2 : Finding Upcoming quizzes

-- ---------------------------------------------------------------------------------- Routine DDL-- Note: comments before and after the routine body will not be stored by the server-- --------------------------------------------------------------------------------DELIMITER $$

CREATE DEFINER=`root`@`localhost` PROCEDURE `future_quizzes`(in course_name varchar(10),in sect_id int,in given_date date)BEGINselect quiz_idfrom quizzeswhere date > given_dateand quiz_id in ( select quiz_idfrom course_quizwhere course_section_id = (select course_section_idfrom section_course_structurewhere section_id=sect_idand course_structure_id in (select course_structure_idfrom course_structurewhere course_Id=course_name)));

END

call future_quiz('CS101',1,2013-01-01);

iii. Stored procedure 3 : Finding Upcoming workshops-- ---------------------------------------------------------------------------------- Routine DDL-- Note: comments before and after the routine body will not be stored by the server-- --------------------------------------------------------------------------------DELIMITER $$CREATE DEFINER=`root`@`localhost` PROCEDURE `upcoming_workshops_2`(in topic_name varchar(50), in give_date date)BEGINselect *from workshopswhere date(workshops.Start_date)>date(give_date)and workshops.Workshop_ID in ( select Workshop_IDfrom workshops_research_topicwhere workshops_research_topic.R_Topic_ID = (select R_topic_ID from research_topics where title=topic_name));ENDcall upcoming_workshops_2('Communications',2013-01-01);

iv. List of Future Quizzes for a given Course within a given Section and after given Date

Output:

v. Attendance of a given Student in given course

Output:

b. Triggers:

i.New Attendance should be greater than the old otherwise the old value is retained:

CREATE DEFINER=`root`@`localhost` TRIGGER `mydb`.`student_section_course_struct_BEFORE_UPDATE` BEFORE UPDATE ON `student_section_course_struct` FOR EACH ROWIF NEW.Attendence < OLD.Attendence THENSET NEW.Attendence = OLD.Attendence;ELSEIF NEW.Attendence > OLD.Attendence THENSET NEW.Attendence = NEW.Attendence;END IF

ii. Marks cant be greater than maximum and cant be less than 0:

CREATE DEFINER = CURRENT_USER TRIGGER `mydb`.`student_exams_BEFORE_INSERT` BEFORE INSERT ON `student_exams` FOR EACH ROWIF NEW.Marks < 0 THENSET NEW.Marks = 0;ELSEIF NEW.Marks > 50 THENSET NEW.Marks = 50;END IF

iii. Before Deleting Department, delete that department record from Dept_Prog Table:

CREATE DEFINER = CURRENT_USER TRIGGER `mydb`.`department_BEFORE_DELETE` BEFORE DELETE ON `department` FOR EACH ROWdelete from dept_prog where Department_ID=old.Department_ID

iv. After insert into grade_points revert the change

CREATE DEFINER=`root`@`localhost` TRIGGER `mydb`.`grade_points_AFTER_INSERT` AFTER INSERT ON `grade_points` FOR EACH ROWbegindelete from grade_points where Grade=NEW.Grade;end

v. After update grade_points revert the change

CREATE DEFINER=`root`@`localhost` TRIGGER `mydb`.`grade_points_AFTER_UPDATE` AFTER UPDATE ON `grade_points` FOR EACH ROWbeginupdate grade_points set Grade=OLD.Grade where Grade=NEW.Grade;update grade_points set Grade_Point=OLD.Grade_Point where Grade_Point=NEW.Grade_Point;end

vi. After delete restore deleted values

CREATE DEFINER=`root`@`localhost` TRIGGER `mydb`.`grade_points_AFTER_DELETE` AFTER DELETE ON `grade_points` FOR EACH ROWbegininsert into grade_points values (OLD.Grade,OLD.Grade_point);end

c. Java Connected Table

8. References

a. http://stackoverflow.com/b. http://dba.stackexchange.com/c. http://www.w3schools.com/sql/d. http://dev.mysql.com/doc/refman/5.0/en/


Recommended