55
1 ER (Entity-Relationship Model)

DocumentER

Embed Size (px)

Citation preview

Page 1: DocumentER

1

ER (Entity-Relationship Model)

Page 2: DocumentER

2

Answer to Exercise 3.16

The university keeps track of each student's name, student number, social security number, current address and phone, permanent address and phone, birthdate, sex, class (freshman, sophomore, ..., graduate), major department, minor department (if any), and degree program (B.A., B.S., ..., Ph.D.). Some user applications need to refer to the city, state, and zip of the student's permanent address, and to the student's last name. Both social security number and student number have unique values for each student.

Page 3: DocumentER

3

Answer to Exercise 3.16

STUDENT

name

Studentnumber

Socialsecuritynumber

current address

currentphone permanent

address

permanent phone birthdate

sexclass

majordepartment

minordepartment

degree program

UPPERCASE LETTERS

Lowercase letters

Page 4: DocumentER

4

Answer to Exercise 3.16

UPPERCASE LETTERS

COURSE

DEPARTMENT

DEP_COU

N

1

Page 5: DocumentER

5

Answer to Exercise 3.16

Requirements ER schema ER Diagram

Page 6: DocumentER

6

Answer to Exercise 3.16

Requirements ER schema

Page 7: DocumentER

7

Answer to Exercise 3.16

1. The university keeps track of each student's name, student number, social security number, current address and phone, permanent address and phone, birthdate, sex, class (freshman, sophomore, ..., graduate), major department, minor department (if any), and degree program

Page 8: DocumentER

8

Answer to Exercise 3.16

1. The university keeps track of each student's name, student number, social security number, current address and phone, permanent address and phone, birthdate, sex, class (freshman, sophomore, ..., graduate), major department, minor department (if any), and degree program

name

Studentnumber

Socialsecuritynumber

current address

currentphone permanent

address

permanent phone birthdate

sexclass

majordepartment

minordepartment

degree program

STUDENT

Page 9: DocumentER

9

Answer to Exercise 3.16

name

Studentnumber

Socialsecuritynumber

current address

currentphone permanent

address

permanent phone birthdate

sexclass

majordepartment

minordepartment

degree program

STUDENT

…Some user applications need to refer to the city, state, and zip of the student's permanent address, and to the student's last name. Both social security number and student number have unique values for each student.

Page 10: DocumentER

10

Answer to Exercise 3.16

Some user applications need to refer to the city, state, and zip of the student's permanent address, and to the student's last name. Both social security number and student number have unique values for each student.

name

Studentnumber

Socialsecuritynumber

current address

currentphone permanent

address

permanent phone birthdate

sexclass

majordepartment

minordepartment

degree program

Minit

Fname

Lname

city state zip

STUDENT

Page 11: DocumentER

11

Answer to Exercise 3.16

Some user applications need to refer to the city, state, and zip of the student's permanent address, and to the student's last name. Both social security number and student number have unique values for each student.

name

Studentnumber

Socialsecuritynumber

current address

currentphone permanent

address

permanent phone birthdate

sexclass

majordepartment

minordepartment

degree program

Minit

Fname

Lname

city state zip

STUDENT

Page 12: DocumentER

12

Answer to Exercise 3.16

2. Each department is described by a name, department code, office number, office phone, and college. Both name and code have unique values for each department.

Page 13: DocumentER

13

Answer to Exercise 3.16

2. Each department is described by a name, department code, office number, office phone, and college. Both name and code have unique values for each department.

Departmentname

Departmentcode

Officenumber

DEPARTMENT

CollegeOfficephone

Page 14: DocumentER

14

Answer to Exercise 3.16

2. Each department is described by a name, department code, office number, office phone, and college. Both name and code have unique values for each department.

Departmentname

Departmentcode

Officenumber

DEPARTMENT

CollegeOfficephone

Page 15: DocumentER

15

Answer to Exercise 3.16

3. Each course has a course name, description, course number, number of semester hours, level, and offering department. The value of course number is unique for each course.

Page 16: DocumentER

16

Answer to Exercise 3.16

3. Each course has a course name, description, course number, number of semester hours, level, and offering department. The value of course number is unique for each course.

Coursename Description

Coursenumber Level

Number of semester

hoursOffering

department

COURSE

Page 17: DocumentER

17

Answer to Exercise 3.16

3. Each course has a course name, description, course number, number of semester hours, level, and offering department. The value of course number is unique for each course.

Coursename Description

Coursenumber Level

Number of Semester

hoursOffering

department

COURSE

Page 18: DocumentER

18

Answer to Exercise 3.16

4. Each section has an instructor, semester, year, course, and section number. The section number distinguishes different sections of the same course that are taught during the same semester/year; its values are 1, 2, 3, ...; up to the number of sections taught during each semester.

Page 19: DocumentER

19

Answer to Exercise 3.16

4. Each section has an instructor, semester, year, course, and section number. The section number distinguishes different sections of the same course that are taught during the same semester/year; its values are 1, 2, 3, ...; up to the number of sections taught during each semester.

Instructor Semester Year Course

SECTION

Sectionnumber

Page 20: DocumentER

20

Answer to Exercise 3.16

Instructor

SemesterYear Sectionnumber

Course

SECTION

Partial key

Page 21: DocumentER

21

Answer to Exercise 3.16

Instructor

SemesterYear Sectionnumber

Course

SECTION

Partial key

Page 22: DocumentER

22

Answer to Exercise 3.16

5. A grade report has a student, section, letter grade, and numeric grade (0, 1, 2, 3,4 for F, D, C, B, A, respectively).

Page 23: DocumentER

23

Answer to Exercise 3.16

5. A grade report has a student, section, letter grade, and numeric grade (0, 1, 2, 3,4 for F, D, C, B, A, respectively).

Lettergrade

Numbergrade

GRADE

Student Section

Page 24: DocumentER

24

Answer to Exercise 3.16

5. A grade report has a student, section, letter grade, and numeric grade (0, 1, 2, 3,4 for F, D, C, B, A, respectively).

Lettergrade

Numbergrade

GRADE

Student Section

Page 25: DocumentER

25

Answer to Exercise 3.16

Requirements ER schema ER Diagram

Page 26: DocumentER

26

STUDENT

DEPARTMENT COURSE

SECTION

GRADE

name

Studentnumber

Socialsecuritynumber

current address

currentphone permanent

address

permanent phone birthdate

sexclass

majordepartment

minordepartment

degree program

Minit

Fname

Lname

city state zip

STUDENT

Page 27: DocumentER

27

STUDENT

Studentnumber

Socialsecuritynumber major

department

minordepartment

STUDENT

DEPARTMENT COURSE

SECTION

GRADE

Page 28: DocumentER

28

STUDENT

STUDENT

COURSESECTION GRADE

DEPARTMENT

majordepartment

minordepartment

Page 29: DocumentER

29

STUDENT

STUDENT DEPARTMENT

N 1

MAJOR

Page 30: DocumentER

30

STUDENT

N 1MAJOR

DEPARTMENTSTUDENT

Page 31: DocumentER

31

STUDENT

STUDENT DEPARTMENTMINOR

M N

Page 32: DocumentER

32

STUDENT

STUDENT DEPARTMENTMINORM N

Page 33: DocumentER

33

STUDENT

STUDENT DEPARTMENT

N 1

MINORM N

MAJOR

OK.

Page 34: DocumentER

34

DEPARTMENT

STUDENT

COURSESECTION GRADE

departmentname

departmentcode

officenumber

DEPARTMENT

collegeofficephone

Page 35: DocumentER

35

DEPARTMENT

STUDENT

COURSESECTION GRADE

departmentname

departmentcode

DEPARTMENT

Page 36: DocumentER

36

DEPARTMENT

DEPARTMENT

OK.

Page 37: DocumentER

37

COURSE

STUDENT

SECTION GRADE

coursename description

coursenumber level

number of semester hours offering

department

COURSE

DEPARTMENT

Page 38: DocumentER

38

COURSE

STUDENT

SECTION GRADE

coursenumber offering

department

COURSE

DEPARTMENT

Page 39: DocumentER

39

COURSE

STUDENTSECTION GRADE

offeringdepartment

COURSE

DEPARTMENT

Page 40: DocumentER

40

COURSE

COURSE

DEPARTMENT

DEP_COU

N

1

Page 41: DocumentER

41

COURSE

COURSE

DEPARTMENT

DEP_COU

N

1

OK.

Page 42: DocumentER

42

SECTION

STUDENT GRADECOURSE

DEPARTMENT

instructor

semesteryear Sectionnumber

course

SECTION

partial key

Page 43: DocumentER

43

SECTION

STUDENT GRADECOURSE

DEPARTMENT

course

SECTION

partial key

Page 44: DocumentER

44

SECTION

STUDENT GRADE

COURSE

DEPARTMENT

course

SECTION

Page 45: DocumentER

45

SECTION

COURSE

SECTION

COU_SEL

N

1

Page 46: DocumentER

46

SECTION

COURSE

SECTION

COU_SEL

N

1

OK.

Page 47: DocumentER

47

GRADE

STUDENT COURSEDEPARTMENT

SECTION

lettergrade

numbergrade

GRADE

student section

Page 48: DocumentER

48

GRADE

STUDENT COURSEDEPARTMENT

SECTION

lettergrade

numbergrade

GRADE

student section

Page 49: DocumentER

49

GRADE

STUDENT

COURSEDEPARTMENT

SECTIONGRADE

student

section

Page 50: DocumentER

50

GRADE

STUDENT

SECTIONGRADE STU_SEC_GR

Page 51: DocumentER

51

GRADE

STUDENT

SECTIONGRADE STU_SEC_GR

N

NN

A B

Page 52: DocumentER

52

GRADE

STUDENT

SECTIONGRADE STU_SEC_GR

N

NN

A B

OK.

Page 53: DocumentER

53

GRADE

STUDENT

GRADE STU_SEC_GR

N

NN

COU_SEL

N

1

DEP_COU

N

1

COURSE

N 1

MINORM N

MAJOR

DEPARTMENT

SECTION

Page 54: DocumentER

54

Answer to Exercise 3.19

(1) The database represents each AIRPORT, keeping its unique AirportCode, the AIRPORT Name, and the City and State in which the AIRPORT is located.(2) Each airline FLIGHT has a unique number, the Airline for the FLIGHT, and the Weekdays on which the FLIGHT is scheduled (for example, every day of the week except Sunday can be coded as X7).(3) A FLIGHT is composed of one or more FLIGHT LEGs (for example, flight number CO1223 from New York to Los Angeles may have two FLIGHT LEGs: leg 1 from New York to Houston and leg 2 from Houston to Los Angeles). Each FLIGHT LEG has a DEPARTURE AIRPORT and Scheduled Departure Time, and an ARRIVAL AIRPORT and Scheduled Arrival Time.

Page 55: DocumentER

55

Answer to Exercise 3.19

(4) A LEG INSTANCE is an instance of a FLIGHT LEG on a specific Date (for example, CO1223 leg 1 on July 30, 1989). The actual Departure and Arrival AIRPORTs and Times are recorded for each flight leg after the flight leg has been concluded. The Number of available seats and the AIRPLANE used in the LEG INSTANCE are also kept.(5) The customer RESERVATIONs on each LEG INSTANCE include the Customer Name, Phone, and Seat Number(s) for each reservation.(6) Information on AIRPLANEs and AIRPLANE TYPEs are also kept. For each AIRPLANE TYPE (for example, DC-10), the TypeName, manufacturing Company, and Maximum Number of Seats are kept. The AIRPORTs in which planes of this type CAN LAND are kept in the database. For each AIRPLANE, the AirplaneId, Total number of seats, and TYPE are kept.