Introduction to Database Systems

Slides:



Advertisements
Similar presentations
Banking Business Scenario
Advertisements

ER Model For a college DB
ER Modeling Case Studies
Exercise 1 Consider the ER diagram below. Assume that an employee may work in up to two departments or may not be assigned to any department. Assume that.
Database Design The process of finding user requirement
Entity-Relationship Modeling (ER-M)
Developing ER-Diagram
ER Modeling Case Studies
ER Modeling Case Studies
Data Modeling (CB 12) CPSC 356 Database Ellen Walker Hiram College (Includes figures from Database Systems by Connolly & Begg, © Addison Wesley 2002)
Entity-Relationship Models
1 The Entity-Relationship Model Chapter 2. 2 Exercise  What can you say about policy of the bank from the ER diagram?  What can you say about the policy.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
ENTITY RELATIONSHIP MODELLING
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
Text-Book Chapters (7 and 8) Entity-Relationship Model
Conceptual Models Agenda - Steps in the design of a DB - Need for conceptual models - The Entity-Relationship Model (ER-Model)
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
The (min,max) notation (1,1) (0,1) (1,N) (1,1). SUMMARY OF ER-DIAGRAM NOTATION FOR ER SCHEMAS Meaning ENTITY TYPE WEAK ENTITY TYPE RELATIONSHIP TYPE IDENTIFYING.
1 Data Modelling Which data to include in the database.
Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.
Class Number – CS 304 Class Name - DBMS Instructor – Sanjay Madria Instructor – Sanjay Madria Lesson Title – ER Model.
Chapter 2 Modeling Data in the Organization
ER Modeling Case Studies
Entity Relationship Model Chapter 6. Basic Elements of E-R Model Entity Object of the real world that stores data. Eg. Customer, State, Project, Supplier,
ER Modeling Case Studies
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas.
Data Modeling Using the Entity-Relationship Model
the Entity-Relationship Model
Lecture 2: Entity-Relationship Modeling
CHAPTER 2. FUNDAMENTAL OF ENTITY RELATIONSHIP (ER)
Practice of ER modeling
Instructor :Huda Al-Omair
Introduction to Database Systems
Entity-Relationship Model Ch. 3
ER Data Models Ctd. CSET 3300.
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
Dept. of Computer & Information Sciences
Database Design 3: Advanced Data Modeling Concepts CS 320.
Data modeling using the entity-relationship model Chapter 3 Objectives How entities, tuples, attributes and relationships among entities are represented.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
Weak Entity Sets A weak entity is an entity that cannot exist in a database unless another type of entity also exists in that database. Weak entity meets.
Entity-Relationship Model Chapter 3 II COSC 457 Sungchul Hong.
Data Modelling Using Entity-Relationship (ER) Model
COMP3030 Database Management System Final Review
Introduction to Database Systems
DatabaseIM ISU1 Fundamentals of Database Systems Chapter 3 Data Modeling Using Entity-Relationship Model.
Chapter 3: Data Modeling Using the Entity-Relationship (ER) Data Model
CSE 412/598 DATABASE MANAGEMENT COURSE NOTES 3. ENTITY-RELATIONSHIP CONCEPTUAL MODELING Department of Computer Science & Engineering Arizona State University.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
1 CS 430 Database Theory Winter 2005 Lecture 3: A Fifty Minute Introduction to Data Modeling.
MIS 3053 Database Design & Applications The University of Tulsa Professor: Akhilesh Bajaj ER Model Lecture 3 © Akhilesh Bajaj, 2000, 2002, All Rights.
Chapter 7 Data Modeling Using the Entity-Relationship (ER) Model
1 What is a Database Management System? Lecture slides by Dr. Sara Cohen Spring 2008.
Databases (CS507) CHAPTER 7.
The Entity-Relationship Model
Enhanced Entity-Relationship and Object Modeling Objectives
E-R Diagram (Cont.) Draw ER Diagram for the following scenario:
Dept. of Computer & Information Sciences
Database EER.
ER Modeling Case Studies
Practice of ER modeling
ERD Exercises.
Practice of ER modeling
Chapter 2 Modeling Data in the Organization
CS4222 Principles of Database System
376a. Database Design Dept. of Computer Science Vassar College
ER Modeling Case Studies
ER Modeling Case Studies
Entity Relation Model Tingting Zhang.
Presentation transcript:

Introduction to Database Systems 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)

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. Chapter 3 Practice Exercises 16

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. Chapter 3 Practice Exercises 17

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. Chapter 3 Practice Exercises 18

Exercise 6 (solution) SSN PName Age Rank PNo SDate EDate 1 N PROFESSOR Sponsor SDate EDate MANAGES 1 N PROFESSOR PROJECT Budget WORKS_ON M N 1 M M Specialty M 1 RUNS WORKS_IN SUPERVISES WORKS -ON2 N N Time 1 N 1 senior 1 MAJOR N ADVISES DEPARTMENT GRAD_STUDENT Graduate N DNo DName Office SSN SName Age Degree Chapter 3 Practice Exercises 19

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. Chapter 3 Tutorial 5

Exercise 4 (solution) LibNo LibName BookNo Title 1 HOLDS N LIBRARY PageCount M N Location WRITTEN_BY CHECK -OUT DueDate AuthorNo N 1 AUTHOR PATRON PatronName AuthorName PatronNo PatronWeight Chapter 3 Tutorial 6

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. Chapter 3 Tutorial 7

Exercise 5 (solution) Assumption: each loan to a student (for different schools) is given a unique LoanId number. SSN SName LoanId Date Amount 1 BORROWS N STUDENT LOAN Payment Duration M SAddress N Interest ATTENDS APPROVED_BY NoOfYears Balance SchoolName N 1 SCHOOL BANK BankName SchoolId SchoolAddress BankId BankBranch Chapter 3 Tutorial 8

Exercise 2 Consider the ER diagram below. Assume that an employee may work in up to two departments or may not be assigned to any department. Assume that each department must have one and may have up to three phone numbers. Supply (min, max) constraints on this diagram. State clearly any additional assumptions you make. (1,50) 1. Each department can have (1-50) employee(s). (0,2) WORKS-IN EMPLOYEE DEPARTMENT 4. Each employee is assigned (1-5) phone(s). (1,5) (1,3) HAS-PHONE CONTAINS PHONE 3. Each phone is assigned to (1-10) employee(s). (1,10) 2. Each phone is used by only 1 department. (1,1) Assumptions: Chapter 3 Tutorial 3

Exercise 3 For each of the following pairs of rules, draw an ER diagram showing the cardinality and participation constraints: A doctor may treat many patients. A patient may have a designated doctor for different types of problems. A hospital has many patient rooms. Each patient room belongs to that hospital. An author may write many books. A book may be written by more than one author. DOCTOR PATIENT TREATS M N HOSPITAL ROOM HAS 1 N AUTHOR BOOK WRITES M N Chapter 3 Tutorial 4

Exercise 6 Consider the following set of requirements for a university database that is used to keep track of students’ transcripts. a. The university keeps track of each student’s name, student number, SSN, 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.,...).Some user applications need to refer to the city, state, and zip code of the student’s permanent address and to the student’s last name. Both SSN 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. Chapter 3 Tutorial 9

Exercise 6 c. Each course has a course name, description, course number, number of semester hours, level, and offering department. The value of the course number is unique for each course. d. Each section has an instructor, semester, year, course, and section number. The section number distinguishes 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, or 4). 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. Chapter 3 Tutorial 10

Exercise 6 (Solution) Chapter 3 Tutorial 11