Presentation is loading. Please wait.

Presentation is loading. Please wait.

Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.

Similar presentations


Presentation on theme: "Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems."— Presentation transcript:

1 Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems (Chapter 3 Practice Exercises)

2 Chapter 3 Tutorial5 Exercise 4 Identify the entities and relationships for the following description and draw an ER diagram. A library system contains libraries, books, authors and patrons, with identifying attributes library Number, book number, author number, and patron number, respectively. Libraries are further described by a library name and location, books by title and page count, authors by author name, and patrons by patron name and patron weight. Libraries hold numerous books (some with multiple copies), each authored by one or more authors. Patrons borrow books, but at any point in time, may not have anything checked out. When they do have a book checked out, there is a due date associated with it.

3 Chapter 3 Tutorial6 Exercise 4 (solution) LIBRARYBOOK HOLDS CHECK -OUT LibNo Location LibNameBookNoTitle PageCount PATRON PatronName AUTHOR AuthorName AuthorNo PatronNoPatronWeight WRITTEN_BY 1N N 1 M N DueDate

4 Chapter 3 Tutorial7 Exercise 5 A loan company wants to design a database to track student loans. Each student attending school is eligible for a loan. A student may have more than one loan. A student may be registered, possibly at different times, in more than one school. Each loan should belong to only one bank. Each bank can approve as many loans as it desires. For each loan, the loan company will track: the student’s SSN, name, address, amount of loan, date of loan, interest rate ( which may be different for each loan as determined by the bank), duration of loan, monthly payment, remaining balance, school ID, school name and address, number of years the student has been at the school, bank name, bank branch and bank ID. Draw an ER diagram. State any assumptions you make in the diagram.

5 Chapter 3 Tutorial8 Exercise 5 (solution) STUDENTLOAN BORROWS APPROVED_BY SSNSNameLoanId Payment BANK BankName SCHOOL SchoolId 1N N 1 SAddress ATTENDS M N SchoolAddress SchoolName BankIdBankBranch DateAmount Duration Interest Balance Assumption: each loan to a student (for different schools) is given a unique LoanId number. NoOfYears

6 Chapter 3 Practice Exercises16 Exercise 6 Consider the following information about a university database: Professors have a SSN, a name, an age, a rank, and a research specialty. Projects have a project number, a sponsor name (e.g. NFS), a starting date, an ending date, and a budget. Graduate students have a SSN, a name, an age, and a degree program (e.g., M.S. or Ph.D.). Each project is managed by one professor (known as the project's principal investigator). Each project is worked on by one or more professors (known as the project's co-investigators). Professors can manage and/or work on multiple projects.

7 Chapter 3 Practice Exercises17 Exercise 6 Each project is worked on by one or more graduate students (known as the project's research assistants). When graduate students work on a project, a professor must supervise their work on the project. Graduate students can work on multiple projects, in which case they will have a (potentially different) supervisor for each one. Departments have a department number, a department name, and a main office. Departments have a professor (known as the chairman) who runs the department. Professors work in one or more departments, and for each department that they work in, a time percentage is associated with their job.

8 Chapter 3 Practice Exercises18 Exercise 6 Graduate students have one major department in which they are working on their degree. Each graduate student has another, more senior graduate student (known as a student advisor) who advises him or her on what courses to take. Draw an ER diagram that captures the information about the university.

9 Chapter 3 Practice Exercises19 Exercise 6 (solution) PROFESSORPROJECT MANAGES WORKS -ON2 GRAD_STUDENT DEPARTMENT SSN SUPERVISES 1N M N N 1 SSNAgePNameRank Specialty WORKS_ON M PNoSDate Sponsor EDate Budget SName Age Degree ADVISES 1 N senior Graduate MAJOR N DNo DName Office WORKS_INRUNS 1 1 M NTime 1 M N


Download ppt "Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems."

Similar presentations


Ads by Google