0% found this document useful (0 votes)
15 views12 pages

Aryan DBMS Assignment 1

The document outlines the design of a comprehensive Database Management System for a technical university, detailing entity sets such as Departments, Faculty, Courses, and Students, along with their relationships. It includes SQL queries for creating the database and tables, as well as sample queries for retrieving student details, faculty research involvement, course completion reports, and placement statistics. The assignment is submitted by Aryan Dixit to Dr. Nikhil Kumar Singh at IIIT Bhopal.

Uploaded by

mrunknownsir10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views12 pages

Aryan DBMS Assignment 1

The document outlines the design of a comprehensive Database Management System for a technical university, detailing entity sets such as Departments, Faculty, Courses, and Students, along with their relationships. It includes SQL queries for creating the database and tables, as well as sample queries for retrieving student details, faculty research involvement, course completion reports, and placement statistics. The assignment is submitted by Aryan Dixit to Dr. Nikhil Kumar Singh at IIIT Bhopal.

Uploaded by

mrunknownsir10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

INDIAN INSTITUTE OF

INFORMATION TECHNOLOGY,
BHOPAL

Assignment 1

Database Management System


Information Technology (Section-2)

Submitted by: Submitted to:


Aryan Dixit Dr. Nikhil Kumar Singh,
Scholar no.: 23U03116 IIIT Bhopal
Title: Designing a Comprehensive Database System for a Technical University

Design a University Database Management System for a Technical University. The system
should be capable of managing various departments, student records, faculty details, course
enrollments, research activities, and administrative functions.

Solution

Entity-Sets
1. Department (Dept_ID, Dept_name)
2. Faculty (Faculty_ID, Name, Designation, Dept_ID)
3. Courses (Course_ID, Course_name, Credits, Semester, Dept_ID)
4. Student (Student_ID, Name, DOB, Gender, Address, Grade, Fee_Status, Dept_ID)
5. Enrollment (Student_ID, Course_ID, Enrollment_Date)
6. Hostel (Hostel_No, Hostel_name, Room_number)
7. TnP (Student_ID, Company_name, Package, Allocation_date, Phone_no)
8. Exam_records (Student_ID, Course_ID, Semester)
9. Offers (Offer_ID, Student_ID, Company_name, Course_ID)
10. Issues_Books (Student_ID, Book_ID, Issue_Date, Due_date)
11. Lives_in (Student_ID, Hostel_No)
12. Faculty_Courses (Faculty_ID, Course_ID)
13. Faculty_Research (Faculty_ID, Dept_ID, Research_topic)
14. Library (Book_ID, Book_Title, Author)

Relationships
● Department has Faculty (One-to-many: A department can have multiple faculty
members)
● Department offers Courses (One-to-many: A department can offer multiple courses)
● Faculty belongs to Department (Many-to-one: A faculty member belongs to one
department)
● Faculty teaches Courses (Many-to-many: A faculty member can teach multiple courses,
and a course can be taught by multiple faculty members)
● Faculty does Faculty_Research in Department (Many-to-many: Faculty can do research
in different departments, and a department has multiple research areas/faculty)
● Courses are offered by Department (Many-to-one: A course is offered by
one department)
● Student belongs to Department (Many-to-one: A student belongs to one department)
● Student enrolls in Courses (Many-to-many: A student can enroll in multiple courses, and
a course can have multiple students) - Represented by Enrollment
● Student has Exam_records for Courses (One-to-many with composite key: A student has
exam records for multiple courses)
● Student gets Offers from TnP (Many-to-many: Students can get offers from
multiple companies) - Represented by Offers
● Student lives in Hostel (Many-to-many: Students can live in different hostels over time)
- Represented by Lives_in
● Student issues Issues_Books from Library (Many-to-many: Students can issue many
books, and a book can be issued by many students)
● Courses are taught by Faculty (Many-to-many: A course can be taught by multiple
faculty, and a faculty can teach multiple courses) - Represented by
Faculty_Courses
● TnP gives Offers to Student (One-to-many)
● Library has Issues_Books issued to Student (One-to-many)
● Hostel has Lives_in with Student (One-to-many)
ER Diagram
SQL Queries for the database

CREATE DATABASE IF NOT EXISTS university_db;


USE university_db;

CREATE TABLE Department (


Dept_ID INT PRIMARY KEY,
Dept_name VARCHAR(255)
);

CREATE TABLE Faculty (


Faculty_ID INT PRIMARY KEY,
Name VARCHAR(255),
Designation VARCHAR(255),
Dept_ID INT,
FOREIGN KEY (Dept_ID) REFERENCES Department(Dept_ID)
);
CREATE INDEX idx_Faculty_Dept_ID ON Faculty(Dept_ID);

CREATE TABLE Courses (


Course_ID INT PRIMARY KEY,
Course_name VARCHAR(255),
Credits INT,
Semester INT,
Dept_ID INT,
FOREIGN KEY (Dept_ID) REFERENCES Department(Dept_ID)
);
CREATE INDEX idx_Courses_Dept_ID ON Courses(Dept_ID);

CREATE TABLE Student (


Student_ID INT PRIMARY KEY,
Name VARCHAR(255),
DOB DATE,
Gender VARCHAR(10),
Address VARCHAR(255),
Grade VARCHAR(10),
Fee_Status VARCHAR(50),
Dept_ID INT,
FOREIGN KEY (Dept_ID) REFERENCES Department(Dept_ID)
);
CREATE INDEX idx_Student_Dept_ID ON Student(Dept_ID);
CREATE TABLE Enrollment (
Student_ID INT,
Course_ID INT,
Enrollment_Date DATE, -- You might want to add an enrollment date
PRIMARY KEY (Student_ID, Course_ID), -- Composite key: student and course
FOREIGN KEY (Student_ID) REFERENCES Student(Student_ID),
FOREIGN KEY (Course_ID) REFERENCES Courses(Course_ID)
);
CREATE INDEX idx_Enrollment_Student_ID ON Enrollment(Student_ID);
CREATE INDEX idx_Enrollment_Course_ID ON Enrollment(Course_ID);

CREATE TABLE Hostel (


Hostel_No INT PRIMARY KEY,
Hostel_name VARCHAR(255),
Room_number INT
);

CREATE TABLE TnP (


Student_ID INT,
Company_name VARCHAR(255),
Package DECIMAL(10,2),
Allocation_date DATE,
Phone_no VARCHAR(20),
PRIMARY KEY (Student_ID, Company_name),
FOREIGN KEY (Student_ID) REFERENCES Student(Student_ID)
);
CREATE INDEX idx_TnP_Student_ID ON TnP(Student_ID);
CREATE INDEX idx_TnP_Company_name ON
TnP(Company_name);

CREATE TABLE Exam_records (


Student_ID INT,
Course_ID INT,
Semester INT,
PRIMARY KEY (Student_ID, Course_ID, Semester),
FOREIGN KEY (Student_ID) REFERENCES Student(Student_ID),
FOREIGN KEY (Course_ID) REFERENCES Courses(Course_ID)
);
CREATE INDEX idx_Exam_records_Student_ID ON Exam_records(Student_ID);
CREATE INDEX idx_Exam_records_Course_ID ON Exam_records(Course_ID);

CREATE TABLE Offers (


Offer_ID INT PRIMARY KEY,
Student_ID INT,
Company_name VARCHAR(255),
Course_ID INT, -- Or other relevant identifier
FOREIGN KEY (Student_ID) REFERENCES Student(Student_ID),
FOREIGN KEY (Company_name) REFERENCES TnP(Company_name),
FOREIGN KEY (Course_ID) REFERENCES Courses(Course_ID)
);
CREATE INDEX idx_Offers_Student_ID ON Offers(Student_ID);
CREATE INDEX idx_Offers_Company_name ON
Offers(Company_name); CREATE INDEX idx_Offers_Course_ID ON
Offers(Course_ID);

CREATE TABLE Issues_Books (


Student_ID INT,
Book_ID INT,
Issue_Date DATE,
Due_date DATE,
PRIMARY KEY (Student_ID, Book_ID),
FOREIGN KEY (Student_ID) REFERENCES Student(Student_ID),
FOREIGN KEY (Book_ID) REFERENCES Library(Book_ID)
);
CREATE INDEX idx_Issues_Books_Student_ID ON Issues_Books(Student_ID);
CREATE INDEX idx_Issues_Books_Book_ID ON Issues_Books(Book_ID);

CREATE TABLE Lives_in (


Student_ID INT,
Hostel_No INT,
PRIMARY KEY (Student_ID, Hostel_No),
FOREIGN KEY (Student_ID) REFERENCES Student(Student_ID),
FOREIGN KEY (Hostel_No) REFERENCES Hostel(Hostel_No)
);
CREATE INDEX idx_Lives_in_Student_ID ON Lives_in(Student_ID);
CREATE INDEX idx_Lives_in_Hostel_No ON Lives_in(Hostel_No);

CREATE TABLE Faculty_Courses (


Faculty_ID INT,
Course_ID INT,
PRIMARY KEY (Faculty_ID, Course_ID),
FOREIGN KEY (Faculty_ID) REFERENCES Faculty(Faculty_ID),
FOREIGN KEY (Course_ID) REFERENCES Courses(Course_ID)
);
CREATE INDEX idx_Faculty_Courses_Faculty_ID ON Faculty_Courses(Faculty_ID);
CREATE INDEX idx_Faculty_Courses_Course_ID ON Faculty_Courses(Course_ID);
CREATE TABLE Faculty_Research (
Faculty_ID INT,
Dept_ID INT,
Research_topic VARCHAR(255),
PRIMARY KEY (Faculty_ID, Dept_ID),
FOREIGN KEY (Faculty_ID) REFERENCES Faculty(Faculty_ID),
FOREIGN KEY (Dept_ID) REFERENCES Department(Dept_ID)
);
CREATE INDEX idx_Faculty_Research_Faculty_ID ON Faculty_Research(Faculty_ID);
CREATE INDEX idx_Faculty_Research_Dept_ID ON Faculty_Research(Dept_ID);

CREATE TABLE Library (


Book_ID INT PRIMARY KEY,
Book_Title VARCHAR(255),
Author VARCHAR(255)
);

Queries to:
a) Retrieve student details based on department and academic year.
SELECT s.Student_ID, s.Name, s.DOB, s.Gender, s.Address, s.Grade, s.Fee_Status,
d.Dept_name
FROM Student s
JOIN Department d ON s.Dept_ID = d.Dept_ID
WHERE d.Dept_name = 'Computer Science'
AND s.Academic_Year = 2024;

b) Find the faculty members involved in research projects.


SELECT f.Faculty_ID, f.Name, f.Designation, d.Dept_name, fr.Research_topic
FROM Faculty f
JOIN Faculty_Research fr ON f.Faculty_ID = fr.Faculty_ID
JOIN Department d ON fr.Dept_ID = d.Dept_ID;

c) Generate a report of students who have completed specific courses.


SELECT s.Student_ID, s.Name, c.Course_name, e.Semester
FROM Student s
JOIN Exam_records e ON s.Student_ID = e.Student_ID
JOIN Courses c ON e.Course_ID = c.Course_ID
WHERE c.Course_name = 'Data Structures';
d) Display placement statistics for the last five years.
SELECT YEAR(t.Allocation_date) AS Placement_Year, COUNT(*) AS
Students_Placed,
AVG(t.Package) AS Avg_Package
FROM TnP t
WHERE t.Allocation_date >= DATE_SUB(CURDATE(), INTERVAL 5 YEAR)
GROUP BY YEAR(t.Allocation_date)
ORDER BY Placement_Year DESC;
OUTPUT

You might also like