Sie sind auf Seite 1von 7

School Information System(SIS)

1) Employee:
emp_num number(3) not null, emp_name char(15) not null, emp_fname char(15) not null, emp_jobcode number(3), emp_hire date, emp_dob date, constraint employee_emp_num_pk primary key (emp_num)); 2) School: school_code char (5) not null, emp_num number(3) not null, school_address char(4) not null, school_office char(1), constraint school_school_code_pk primary key(school_code), constraint school_emp_num_fk foreign key(emp_num) references employee(emp_num) 3)Department: dept_code char(5) not null, dept_name char(15) not null, school_code char(5) not null, emp_num number(3), dept_address char(15), constraint department_dept_code_pk primary key (dept_code), constraint department_emp_num_fk foreign key (emp_num) references employee (emp_num),
constraint department_school_code_fk foreign key (school_code) references school school_code)

4) Course:
crs_code char(8) not null, dept_code char(5) not null, school_code char(5) not null, crs_description char(15) not null, crs_credit number(3) not null, constraint course_crs_code_pk primary key (crs_code), constraint course_dept_code_fk foreign key (dept_code) references department (dept_code)

5) Professor:
emp_num number (3) not null, dept_code char(5) not null, room_code char(8) not null, prof_high_degree char(5) not null, constraint professor_emp_num_pk primary key(emp_num),
constraint professor_dept_code_fk foreign key(dept_code) references department (dept_code)

6) Class:
class_code crs_code class_section class_time room_code emp_num char(5) char (8) char(2) char(15) char(8) number(3) not null, not null, not null, not null, not null, not null,

constraint class_class_code_pk primary key(class_code), constraint class_emp_num_fk foreign key(emp_num) references professor (emp_num), constraint class_crs_code_fk foreign key(crs_code) references course(crs_code)

7)Student:
stu_num stu_1name stu_fname stu_dob stu_hrs stu_class stu_gpa dept_code stu_phone emp_num number (3) char(15) char(15) date, number (3), char (5) number(2), char (5) char (4), number(3), not null, not null, not null, not null, not null,

constraint student_stu_num_pk primary key (stu_num), constraint student_dept_code_fk foreign key (dept_code) references department (dept_code), constraint student_emp_num_fk foreign key(emp_num) references professor(emp_num)

8)Enroll:
class_code char(8) not null, stu_num number(3) not null, enroll_grade char(1), enroll_credit number(3), constraint enroll_class_code_pk primary key (class_code), constraint enroll_stu_num_fk foreign key (stu_num) references student (stu_num)

Insertions
SQL> Insert into employee values(001,'Omer','Asim','O',111,'10-May-2000','15-May-1978'); SQL> Insert into employee values(002,'Imran','Amjad','I',112,'22-Apr-1999','13-Feb-1980'); SQL> Insert into employee values(003,'Ali','Akram','A',113,'13-Oct-2002','24-Dec-1972'); SQL> Insert into school values(2020,001,'KAR','K','K',1111); SQL> Insert into school values(2021,2,'LHR','L','L',1112); SQL> Insert into school values(2022,3,'PSH','I','I',1113);

SQL> Insert into Department values(3210,'Marketing',2020,1,'KAR',1111); SQL> Insert into Department values(3220,'Finance',2021,2,'LHR',1112); SQL> Insert into course values('SM01',3210,2020,'Marketing',3); SQL> Insert into course values('SM02',3220,2021,'Research',3); SQL> Insert into professor values(1,3210,22,5014,'PhD'); SQL> Insert into professor values(2,3220,25,5050,'MBA'); SQL> Insert into student values 2 (121,'Aftab','Yasir','Y','20-Jun-80',5,'BBA01',NULL,NULL,3210,6666,1); SQL> Insert into student values 2 (122,'Sheikh','Zafar','Z','19-Nov-81',5,'BBA02',NULL,NULL,3220,7777,2); SQL> Insert into class values('BBA01,'BA01','A','9:00',22,1); SQL> Insert into class values('BBA02,'BA02','B','12:00',25,2); SQL> Insert into enroll values('BBA01,220,'A',3); SQL> Insert into enroll values('BBA02,222,'C',3);

Entity Relationship Diagrams


1)
Employee

Is a

Professor

Employee PK Emp_num Emp_name Emp_fname Emp_Initial Emp_jobcode Emp_hiredate Emp_dob PK Professor Emp_num Dept_code Room_code Prof_Extension Prof_high_degree

Is a

Description: E-R diagram is showing that every professor is an employee but not all employees are professors.

2)
Employee PK Emp_num Emp_name Emp_fname Emp_Initial Emp_jobcode Emp_hiredate Emp_dob Professor School PK School_code Emp_num School_Address School_Office School_Extension

Is a

PK

Emp_num Dept_code Room_code Prof_Extension Prof_high_degree

Is a dean of

Operates
Department PK Dept_name School_code Emp_num Dept_Address Dept_Extension

Deccription: We have already discussed that employee professor relationship i.e. a professor is a weak entity which is dependent upon employee which is a strong entity. There are several schools in a college such as school of management/computer. Each school is further divided into various departments like economics, marketing, research etc. At least one department is operated by each school but every department individually belongs to a specific school. Also a professor is a dean of a particular school but a school has only one dean. So there is a (1,1) relationship. 3)
Department PK Dept_name School_code Emp_num Dept_Address Dept_Extension PK Course Crs_code dept_code School_code Crs_description Crs_credit

offers

Each department offers several courses. Course is optional to the department but a department is mandatory for every course. This is 1 to M relationship. 4)
Course PK Crs_code dept_code School_code Crs_description Crs_credit Class PK Class_code

generates

Crs_code Class_section Class_time Room_code Emp_num

Description:
A class is formed on the basis of a particular course. There is a 1 to M relationship between class and course as there can be several class sections for a particular course but you cannot teach more than one courses in the same class at the same time. Also a class is dependent upon a course if there is no course than there will be no class. 5)
chairs
Employee PK Emp_num Emp_name Emp_fname Emp_Initial Emp_jobcode Emp_hiredate Emp_dob Professor Department

Is a

PK Emp_num Dept_code Room_code Prof_Extension Prof_high_degree

employs

PK Dept_name School_code Emp_num Dept_Address Dept_Extension

Description:
Each department has professors assigned to it. So, department is again optional to professor as per the chairs relationship. 6)
Employee PK Emp_num Emp_name Emp_fname Emp_Initial Emp_jobcode Emp_hiredate Emp_dob Professor Class

Is a

PK

Emp_num Dept_code Room_code Prof_Extension Prof_high_degree

teaches

PK

Class_code Crs_code Class_section Class_time Room_code Emp_num

Description:
Each professor may teach a certain number of classes. So the class is dependent on the professor. 7)
Student PK stu_num stu_lname stu_fname stu_Initial stu_dob stu_hrs stu_class stu_gpa stu_transfer dept_code stu_phone emp_num Enroll Class PK class_code stu_num enroll_grade enroll_credit PK Class_code Crs_code Class_section Class_time Room_code Emp_num

Is written in

Is found in

Description:
A student may get enrolled in several classes but he cannot get enrolled in one subject twice at the same time. But a class can also accommodate many students so there is many to many relationships between class and students where students are dependent upon the class. This relationship is divided into two one to many relationships by the introduction of the entity Enroll. So enroll is also a weak entity which is dependent upon student and class both. 8)
Department PK Dept_name School_code Emp_num Dept_Address Dept_Extension PK Student stu_num stu_lname stu_fname stu_Initial stu_dob stu_hrs stu_class stu_gpa stu_transfer dept_code stu_phone emp_num

has

Description:
Each department has several students but every student is associated with a single department. For instance a student cannot be in computers department and business department at the same time. 9)
Employee PK Emp_num Emp_name Emp_fname Emp_Initial Emp_jobcode Emp_hiredate Emp_dob Professor PK Emp_num Student PK stu_num

Is a

Dept_code Room_code Prof_Extension Prof_high_degree

advises

stu_lname stu_fname stu_Initial stu_dob stu_hrs stu_class stu_gpa stu_transfer dept_code stu_phone emp_num

Description:
Each student has an advisor in his department and each advisor counsels several students. So there is a one to many relationships between students and advisors.

Combined E-R Diagram


Employee PK Emp_num Emp_name Emp_fname Emp_Initial Emp_jobcode Emp_hiredate Emp_dob PK School School_code Emp_num School_Address School_Office School_Extension

Is dean of

Is a
Professor

operates

Department PK Dept_name School_code Emp_num Dept_Address Dept_Extension

advises

PK

Emp_num Dept_code Room_code Prof_Extension Prof_high_degree

chairs employs

Student PK stu_num stu_lname stu_fname stu_Initial stu_dob stu_hrs stu_class stu_gpa stu_transfer dept_code stu_phone emp_num

offers has
Course

teaches

PK

Crs_code dept_code School_code Crs_description Crs_credit

Class PK Class_code Crs_code Class_section Class_time Room_code Emp_num

Is written in
Enroll PK class_code stu_num enroll_grade enroll_credit

generates

Is found in

Das könnte Ihnen auch gefallen