design problem of dbms
TRANSCRIPT
-
7/31/2019 Design Problem of Dbms
1/12
Design problem: 1
Database And Management System
Submitted to:
Submitted By:
Miss Jaspreet Kaur Shikha
KumariRoll No. 20
SECTION:
A1811
-
7/31/2019 Design Problem of Dbms
2/12
Problem:
A database is to be designed for a University to monitor students' progress throughout their
course of study. The students are reading for a degree (such as B.Tech, B.Tech (Hons)
MCA, etc) within the framework of the modular system. The University provides a numberof courses, each being characterized by its code, title, credit value, course coordinator,
teaching staff and the department they come from. A course is co-ordinated by a course
coordinator who shares teaching duties with one or more lecturers. A lecturer may teachmore than one course. Students are free to choose any course they wish but the following
rules must be observed: some courses require pre-requisites courses and some degree
programs have compulsory courses. The database is also to contain some information about
students including their numbers, names, addresses, degrees they read for, and their pastperformance (i.e. courses taken and examination results).
Represent the complete scenario with the help of ER Diagram and design logical schemafor this database. Also specify desirable constraints and justify your design approach even
in a single small step.
Relation of entities
University offers degrees: one to many
Degrees has departments: many to many relation
Lecturer belongs to department: many to one relation
Department offers courses: one to many relation
Lecturer teach courses: many to many relation
Instructor plan courses: one to one relation
Instructor shares duties with lecturer: one to many relation
Student studies courses: many to many relation
Student acquire grades: many to one relation
Some courses has prerequisite: one to one relation
Identification of Entities and Relations in ER Diagram
university(university_id, university_name,degree)
courses (course_code, course_name, credit, hours, dept_id)
department ( dept_id, dept_name, HOD)
-
7/31/2019 Design Problem of Dbms
3/12
lecturer (faculty_id, f_name, l_name, salary, phone_no, email, dept_id, inst_id)
instructor(inst_id,f_name,l_name,salary,phone_no,email, course_code)
students (reg_no, f_name, l_name, address, CGPA)
grades ( registration_no, letter_grade, course_code)
studies (course_code, reg_no)
teach (faculty_id, course_code)
prerequisites (course_code, prerequisites)
ER Diagram
(please see the attachment with this document for clear view of diagram)
-
7/31/2019 Design Problem of Dbms
4/12
Entity Relationship Key
-
7/31/2019 Design Problem of Dbms
5/12
-
7/31/2019 Design Problem of Dbms
6/12
Logical schema concentrates on describing entities, data types, relationships
and constraints.
university
Name Null? Type
UNIVERSITY_ID NOT NULL NUMBER(10)
UNIVERSITY_NAME NOT NULL VARCHAR2(20)
courses
Name Null? Type
COURSE_CODE NOT NULL VARCHAR2(20)
COURSE_NAME NOT NULL VARCHAR2(20)CREDIT NOT NULL NUMBER(10)
HOURS NOT NULL NUMBER(10)DEPT_ID NUMBER(10)
department
Name Null? Type
DEPT_ID NOT NULL NUMBER(10)DEPT_NAME NOT NULL VARCHAR2(20)
HOD VARCHAR2(10)
lecturer
Name Null? Type
FACULTY_ID NOT NULL NUMBER(10)F_NAME NOT NULL VARCHAR2(20)
L_NAME VARCHAR2(20)
SALARY NUMBER(10)
PHONE_NO NUMBER(10)
EMAIL VARCHAR2(30)
DEPT_ID NUMBER(10)
INST_ID NUMBER(10)
instructor
Name Null? Type
-
7/31/2019 Design Problem of Dbms
7/12
INST_ID NOT NULL NUMBER(10)
F_NAME NOT NULL VARCHAR2(20)
L_NAME VARCHAR2(20)
SALARY NUMBER(10)
PHONE_NO NUMBER(10)
EMAIL NOT NULL VARCHAR2(20)COURSE_CODE VARCHAR2(20)
student
Name Null? Type
REG_NO NOT NULL NUMBER(10)
F_NAME NOT NULL VARCHAR2(20)
L_NAME VARCHAR2(20)
ADDRESS NOT NULL VARCHAR2(20)
CGPA NUMBER(10)
studies
Name Null? TypeCOURSE_CODE VARCHAR2(20)
REG_NO NUMBER(10)
teach
Name Null? Type
FACULTY_ID NUMBER(10)
COURSE_CODE VARCHAR2(20)has
Name Null? Type
COURSE_CODE VARCHAR2(20)
PREREQUISITES NOT NULL VARCHAR2(50)
Entities with desirable constraints
university( university_id ,
university_name )
courses (course_code ,
course_name ,
credit ,
hours ,
dept_id )
-
7/31/2019 Design Problem of Dbms
8/12
department ( dept_id ,
dept_name ,
HOD)
lecturer (faculty_id ,
f_name ,
l_name,
salary,
phone_no,
email,
dept_id ,
inst_id )
instructor(inst_id ,
f_name ,
l_name,
salary,
phone_no,
email,
course_code id )
students (reg_no,
f_name,l_name,
address,
CGPA)
grades ( reg_no,
letter_grade,
course_code )
Relations with desirable constraints
studies (course_code ,
reg_no )
teach (faculty_id ,
-
7/31/2019 Design Problem of Dbms
9/12
course_code )
has (course_code ,
prerequisites)
Creating tables
CREATE TABLE university( university_id VARCHAR(20) primary
key,
University_name VARCHAR(50) NOT NULL);
CREATE TABLE courses ( course_code VARCHAR(20) Primary
Key,
course_name VARCHAR(20) NOT NULL,
credit NUMBER(10) NOT NULL,
hours NUMBER(10) NOT NULL,
dept_id NUMBER(10) REFERENCES department(dept_id));
CREATE TABLE department( dept_id NUMBER(10) primary key,
dept_name VARCHAR(20) NOT NULL,
HOD VARCHAR(10));
CREATE TABLE instructor( inst_id NUMBER(10) primary key,
f_name VARCHAR(20) NOT NULL,
l_name VARCHAR(20),
salary NUMBER(10),
phone_no NUMBER(10),
email VARCHAR(20) NOT NULL,
-
7/31/2019 Design Problem of Dbms
10/12
course_code VARCHAR(20) REFERENCES courses(course_code));
CREATE TABLE lecturer (faculty_id NUMBER(10) primary key,
f_name VARCHAR(20) NOT NULL,
l_name VARCHAR(20),
salary NUMBER(10),
phone_no NUMBER(10),
email VARCHAR(30),
dept_id NUMBER(10) REFERENCES department(dept_id),
inst_id NUMBER(10) REFERENCES instructor(inst_id));
CREATE TABLE students ( reg_no NUMBER(10) primary key,
f_name VARCHAR(20) NOT NULL,
l_name VARCHAR(20),
address VARCHAR(20) NOT NULL,
CGPA NUMBER(10));
CREATE TABLE grades (registration_no NUMBER(10),
letter_grade VARCHAR(2),
course_code VARCHAR(20));
CREATE TABLE studies (course_code VARCHAR(20)
REFERENCES courses(course_code),
reg_no NUMBER(10) REFERENCES students(reg_no));
-
7/31/2019 Design Problem of Dbms
11/12
CREATE TABLE teach (faculty_id NUMBER(10) REFERENCES
lecturer(faculty_id),
course_code VARCHAR(20) REFERENCES courses(course_code));
CREATE TABLE has ( course_code VARCHAR(20)
REFERENCES courses(course_code),
prerequisites VARCHAR(50) NOT NULL);
Overview of tables createduniversityuniversity_id university_name
coursescourse_code course_name credit_value hours dept_id
departmentdept_id dept_name H.O.D
lecturer
faculty_id f_name l_name salary phone_no email dept_id
instructor
inst_id f_name l_name salary phone_no email cour
students
reg_no f_name l_name address grades
-
7/31/2019 Design Problem of Dbms
12/12
teach
faculty_id course_code
studies
course_code reg_no
has
course_code Prerequisites