Bài tập cơ sở dữ liệu nâng cao tuần 1

7 375 0
  • Loading ...
1/7 trang

Thông tin tài liệu

Ngày đăng: 02/05/2017, 17:00

1 CSC380 – Fundamentals of Database Systems Tutorial # 7.16 Consider the following set of requirements for a UNIVERSITY database that is used to keep track of students' transcripts This is similar but not identical to the database shown in Figure 1.2: a The university keeps track of each student's name, student number, social security number, current address and phone, permanent address and phone, birth date, 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 b 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 c 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 d 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 e A grade report has a student, section, letter grade, and numeric grade (0, 1, 2, 3, for F, D, C, B, A, respectively) Design an ER schema for this application, and draw an ER diagram for that schema Specify key attributes of each entity type and structural constraints on each relationship type Note any unspecified requirements, and make appropriate assumptions to make the specification complete 1 2 Assumptions: • Every department must have at least one student enrolled in it as a major • A student must specify his major when he/she joins the university • Not all departments are used as a minor department for a student’s degree • Every department must offer at least one course • Every course must belong to exactly one department • Not all courses will have sections (a course may be new and will not be offered until next year, or there is no instructor available to teach the course) • A section may not have any students enrolled in it • A student may not sign up for any classes (sections) (for example, the student dropped that semester for medical reasons 7.17 Composite and multi-valued attributes can be nested to any number of levels.Suppose we want to design an attribute for a 3 STUDENT entity type to keep track ofprevious college education Such an attribute will have one entry for each collegepreviously attended, and this entry is composed of: college name, start and enddates, degree entries (degrees awarded at that college, if any), and transcriptentries (courses completed at that college, if any) Each degree entry is formed ofdegree name and the month and year it was awarded, and each transcript entry isformed of a course name, semester, year, and grade Design an attribute to holdthis information Use the conventions of Figure 7.5 Answer: { PreviousEducation ( CollegeName, StartDate, EndDate, { Degree (DegreeName, Month, Year) }, { Transcript (CourseName, Semester, Year, Grade) } ) } Note (background information, not essential for examination): • Note that in Computer Science we usually denote such nested structures in the BNF notationfor defining grammars:PreviousEducationList:: PreviousEducation*PreviousEducation: CollegeName StartDate EndDate Degree* Transcript*Degree : DegreeName Month YearTranscript : CourseName Semester Year Grade • • • Selected exercises Chapter 3, Elmasri & Navathe Problem 7.19 Consider the ER diagram in Figure 7.20, which shows a simplified schema for an airline reservation system Extract from the ER diagram the requirements and constraints that produced this schema Try to be as precise as possible in your requirements and constraints specification 4 Airport - Each airport - Each airport - Each airport - Each airport must must must must have have have have a unique airport code a name the city listed for which it is located the state listed for which it is located Airplane - Each airplane can arrive at an airport during a flight leg - Every airplane has a unique airplane id number - Every airplane has a maximum capacity (Seats) Flight - Each flight has a unique flight number - A flight is composed of one or more flight legs - Each flight must have a designated airline - Each flight leg must have a departure and arrival time defined Fare - Each fare must have a unique code (First class) - Each fare must have a cost/price - Each fare may have restrictions Seat - Each seat has a unique seat number (Seat 14C) - Each seat is based on a customer reservation - Seats are allocated to specific flight legs - The number of seats per flight leg cannot exceed the airplane's maximum capacity 8.20 5 6 7 ... for any classes (sections) (for example, the student dropped that semester for medical reasons 7 .17 Composite and multi-valued attributes can be nested to any number of levels.Suppose we want to... CourseName Semester Year Grade • • • Selected exercises Chapter 3, Elmasri & Navathe Problem 7 .19 Consider the ER diagram in Figure 7.20, which shows a simplified schema for an airline reservation... a cost/price - Each fare may have restrictions Seat - Each seat has a unique seat number (Seat 14 C) - Each seat is based on a customer reservation - Seats are allocated to specific flight legs
- Xem thêm -

Xem thêm: Bài tập cơ sở dữ liệu nâng cao tuần 1, Bài tập cơ sở dữ liệu nâng cao tuần 1, Bài tập cơ sở dữ liệu nâng cao tuần 1

Gợi ý tài liệu liên quan cho bạn

Nhận lời giải ngay chưa đến 10 phút Đăng bài tập ngay