Introduction to Database Systems

Slides:



Advertisements
Similar presentations
Banking Business Scenario
Advertisements

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.
Entity-Relationship Modeling (ER-M)
ER Modeling Case Studies
ER Modeling Case Studies
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.
Chapter 31 Chapter 3 Data Modeling Using the Entity-Relationship Model.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
Draw an ER Diagram for the following (record any assumptions):
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
Information Resources Management February 6, 2001.
Database Systems Chapter 7 ITM 354. Chapter Outline ER-to-Relational Schema Mapping Algorithm –Step 1: Mapping of Regular Entity Types –Step 2: 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.
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
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas.
1 Database Requirements and Design. 2 DATA PEOPLE PROCEDURES HARDWARE SOFTWARE The Product: a working system.
Introduction to Business Organisations
Data Modeling Using the Entity-Relationship Model
the Entity-Relationship Model
Homework 1 Solution.
Practice of ER modeling
Instructor :Huda Al-Omair
Entity-Relationship Model Ch. 3
DATABASEMODELSDATABASEMODELS  A database model ◦ defines the logical design of data. ◦ Describes the relationships between different parts of data.
Assignements. CSC343: Intro. to Databases2 Exercise 1 Superkeys: Candidate keys: Primary key:
Dept. of Computer & Information Sciences
1 Relational Databases and SQL. Learning Objectives Understand techniques to model complex accounting phenomena in an E-R diagram Develop E-R diagrams.
Initial Design of Entity Types for the COMPANY Database Schema Based on the requirements, we can identify four initial entity types in the COMPANY database:
Chapter 7 Data Modeling with Entity Relationship Diagrams
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.
1 The Entity- Relationship Model Instructor: Mohamed Eltabakh
Introduction to Database Systems
DatabaseIM ISU1 Fundamentals of Database Systems Chapter 3 Data Modeling Using Entity-Relationship Model.
Data Modeling Using the Entity-Relationship (ER) Data Model.
Data Modeling Using the Entity- Relationship (ER) Model.
Chapter 3: Data Modeling Using the Entity-Relationship (ER) Data Model
Introduction to Database Systems
CSE 412/598 DATABASE MANAGEMENT COURSE NOTES 3. ENTITY-RELATIONSHIP CONCEPTUAL MODELING Department of Computer Science & Engineering Arizona State University.
Database Management COP4540, SCS, FIU Database Modeling Using the Entity- Relationship Model (Continued)
1 CSE 480: Database Systems Lecture 3: Entity-Relationship Diagram Reference: Read Chapter 3 (5 th Edition) or 7 (6 th edition)
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
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.
Assignements.
The Entity-Relationship Model
Entity-Relationship Model
E-R Diagram (Cont.) Draw ER Diagram for the following scenario:
Database Requirements and Design
ER Diagram Practical Example
Dept. of Computer & Information Sciences
Database EER.
ER Modeling Case Studies
ERD Exercises.
Chapter 2 Modeling Data in the Organization
Database Modeling using Entity Relationship Model (E-R Model)
CS4222 Principles of Database System
376a. Database Design Dept. of Computer Science Vassar College
ER Modeling Case Studies
ER Modeling Case Studies
Database EER.
Entity Relation Model Tingting Zhang.
Database Management system
Entity Relationship Model
Recursive Relationship and Weak Entity Examples
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 3.23 Chapter 3 Practice Exercises 1

Exercise 3.23 (Solution) a. Non weak entity types: BANK ACCOUNT CUSTOMER LOAN b. Weak entity type: BANK-BRANCH Partial key: BranchNo Identifying relationship: BRANCHES c. The partial key specifies that the same BranchNo value may occur under different BANKS. The identifying relationship specifies that BranchNo values are uniquely assigned for those BANK-BRANCH entities that are related to the same BANK entity. (BANK Code + BranchNo = full identifier for BANK-BRANCH). Chapter 3 Practice Exercises 2

Exercise 3.23 (Solution) d. Relationship types and the (min,max) constraints: BRANCHES ACCTS LOANS A-C L-C (1,n) BRANCHES (1,1) BANK BANK-BRANCH (0,n) ACCTS (1,1) BANK-BRANCH ACCOUNT (0,n) LOANS (1,1) BANK-BRANCH LOAN (1,n) A-C (0,n) ACCOUNT CUSTOMER (1,n) L-C (0,n) LOAN CUSTOMER Chapter 3 Practice Exercises 3

Exercise 3.23 (Solution) e. User requirements: Each bank has a unique code, name, and address. Each bank is related to 1 or more bank branches. Each bank branch has an address and a branch number which is unique among each set of bank branches that are related to the same bank. Each bank branch has 0 or more loans and 0 or more accounts. Each account has an unique account number, balance, and type. Each account is related to exactly 1 bank branch and to at least 1 customer. Each loan has a unique loan number, amount, and type. Each loan is related to 1 bank branch and to at least 1 customer. Each customer has a SSN, name, phone, and address. Each customer is related to 0 or more accounts and to 0 or more loans. Chapter 3 Practice Exercises 4

Exercise 3.23 (Solution) f. The new (min, max) constraints: (1,n) A-C ACCOUNT CUSTOMER (1,n) L-C (0,2) LOAN CUSTOMER (0,1000) LOANS (1,1) BANK-BRANCH LOAN Chapter 3 Practice Exercises 5

Exercise 2 Identify the entities and relationships for the following description and draw an ER diagram. Persons, described by their name, SSN, and address, subscribe to various journals. Each journal, identified by a title and an ISBN, has a set of numbered volumes and each of these has a set of numbered issues. Subscribers have an initial subscription date and a termination date for each journal to which they subscribe. Chapter 3 Practice Exercises 6

Exercise 2 (solution) SSN Name ISBN M N PERSON JORNAL Title 1 Address SUBSCRIBE -TO N PERSON JORNAL Title 1 Address InitialDate TerminationDate HAS N N CONTAINED-IN 1 ISSUE VOLUME VolumeNo IssueNo Chapter 3 Practice Exercises 7

Exercise 3 Identify the entities and relationships for the following description and draw an ER diagram. Departments, identified by ID, operate a variety of printers, each located in a particular room in a particular building. Printers are supplied by a number of suppliers, identified by name, with each supplier charging a different price for a given printer, but also providing different delivery delays, measured in days. A given room can have any number of printers, including none. Chapter 3 Practice Exercises 8

Exercise 3 (solution) DId PrinterId 1 N DEPARTMENT PRINTER N M Delay OPERATES N DEPARTMENT PRINTER N M Delay IN SUPPLIED -BY RoomNo Charge 1 N ROOM SUPPLIER BuildingNo SName Chapter 3 Practice Exercises 9

Exercise 4 Draw an ER diagram for the following situation. State any assumptions you believe you have to make in order to develop a complete diagram. Stillwater Antiques buys and sells one-of-a-kind antiques of all kinds (for example, furniture, jewelry, china, and clothing). Each item is uniquely identified by an item number and is also characterized by a description, asking price, condition, and open-ended comments. Stillwater works with many different individuals, called clients, who sell items to and buy items from the store. Some clients only sell items to Stillwater, some only buy items, and some others both sell and buy. A client is identified by a client number and is also described by a client name and client address. Chapter 3 Practice Exercises 10

Exercise 4 When Stillwater sells an item in stock to a client, the owners want to record the commission paid, the actual selling price, sales tax, and date sold. When Stillwater buys an item from a client, the owners want to record the purchase cost, date purchased, and condition at time of purchase. Chapter 3 Practice Exercises 11

Exercise 4 (Solution) SellingPrice Commission Tax DateSold ItemNumber SoldTo ItemNumber Description ClientNumber N 1 Price ITEM CLIENT Name N 1 Condition Comments Bought From Address Cost DateBurchased Condition Chapter 3 Practice Exercises 12

Exercise 5 Draw an ER diagram for the following situation. State any assumptions you believe you have to make in order to develop a complete diagram. Projects, Inc., is an engineering firm with approximately 500 employees. A database is required to keep track of all employees, projects assigned, and departments worked in. every employee has a unique number assigned by the firm, required to store his or her name and date of birth. If an employee is currently married to another employee of projects, Inc., the date of marriage and who is married to whom must be stored; however, no record of marriage is required if an employee’s spouse is not also an employee. Each employee is given a job title (for example, engineer, secretary, and so on). Chapter 3 Practice Exercises 13

Exercise 5 An employee does only one type of job at any given time, and it is only needed to retain information for an employee’s current job . There are 11 different departments, each with a unique name. An employee can report to only one department. Each department has a phone number. To procure various kinds of equipments, each department deals with many vendors. A vendor typically supplies equipment to many departments. It is required to store the name and address of each vendor and the date of the last meeting between a department and a vendor. Many employees can work on a project. An employee can work on many projects. Projects are distinguished by project number, and the estimated cost of each project must be stored. Chapter 3 Practice Exercises 14

Exercise 5 (Solution) LastMeeting DeptName VendorName M BuyesFrom N Phone DEPARTMENT VENDOR 1 Address belongsTo DateMarried EmpNumber ProjName N 1 MarriedTo M WorksOn N EMPLOYEE PROJECT 1 EmpName Title BirthDate Cost Chapter 3 Practice Exercises 15

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