Docsity

Understanding Entity-Relationship (ER) Diagrams: A Comprehensive Guide, Summaries of Computer science

Toggle sidebar
bg1
🏥 Hospital System Scenario
The hospital has many patients who come for treatment. Each patient has a unique ID,
name, and contact details. The hospital employs doctors and nurses who provide care to
patients. When a patient visits, a medical record is created that stores details of their
diagnosis, treatment, and medications prescribed. Appointments are scheduled between
patients and doctors. The hospital also manages wards where patients may be admitted for
overnight stays.
Sample Entities:
Patient
Doctor
Nurse
Medical Record
Appointment
Ward
🏥 Online Shopping Scenario
The online store sells many products, each with a unique product ID, name, and price.
Customers create accounts with their personal information and shipping address. When
customers place orders, an order is generated that records which products were purchased,
quantities, and the total amount. The store has several categories to organize products.
Delivery agents are responsible for shipping orders to customers.
Sample Entities:
Product
Customer Account
Order
Category
Delivery Agent
🎓 School Management Scenario
The school has many students enrolled in various courses. Each student has a student ID,
name, and contact info. Teachers conduct classes for different courses and are assigned to
pf3
pf4
pf5

Partial preview of the text

Download Understanding Entity-Relationship (ER) Diagrams: A Comprehensive Guide and more Summaries Computer science in PDF only on Docsity!

🏥 Hospital System Scenario The hospital has many patients who come for treatment. Each patient has a unique ID, name, and contact details. The hospital employs doctors and nurses who provide care to patients. When a patient visits, a medical record is created that stores details of their diagnosis, treatment, and medications prescribed. Appointments are scheduled between patients and doctors. The hospital also manages wards where patients may be admitted for overnight stays. Sample Entities:  Patient  Doctor  Nurse  Medical Record  Appointment  Ward 🏥 Online Shopping Scenario The online store sells many products , each with a unique product ID, name, and price. Customers create accounts with their personal information and shipping address. When customers place orders, an order is generated that records which products were purchased, quantities, and the total amount. The store has several categories to organize products. Delivery agents are responsible for shipping orders to customers. Sample Entities:  Product  Customer Account  Order  Category  Delivery Agent 🎓 School Management Scenario The school has many students enrolled in various courses. Each student has a student ID, name, and contact info. Teachers conduct classes for different courses and are assigned to

specific departments. The school keeps track of enrollments when students register for courses each semester. Exams are scheduled for courses, and grades are recorded for each student’s performance. Sample Entities:  Student  Course  Teacher  Department  Enrollment  Exam  Grade 💰 Banking System Scenario The bank serves many customers who have various accounts like savings or checking accounts. Each account has an account number and balance. Customers can make transactions such as deposits and withdrawals. The bank employs employees who manage customer services. Loan applications are processed for customers seeking financial help. Branches of the bank provide services in different locations. Sample Entities:  Customer  Account  Transaction  Employee  Loan Application  Branch

Entity Hunt Scenario: Library System

 The city library has many books available for readers. Each book has a title, author, and unique identification number. People who want to borrow books must register as members by providing their name and membership ID. The library also employs librarians who manage the book loans and returns. When a member borrows a book, a loan record is created, which notes the member’s ID, the book’s ID, and the due date for returning the book. Sometimes, members reserve books that are currently

4. Key Attribute  Special attribute that uniquely identifies an entity.  Usually underlined in ER diagrams.  (Note: This topic can be covered separately as you planned.) 5. Role of Attributes  Store specific information.  Help distinguish entities.  Basis for queries and data retrieval. 6. Examples and Practice  Identify attributes for common entities (e.g., Student: Name, Roll Number, DOB)  Classify given attributes into types. Activity

 🏥 Hospital System

 The hospital treats many patients , each having a patient ID , name , date of birth , and contact number. Doctors and nurses work at the hospital; doctors have a doctor ID , specialization , and name , while nurses have a nurse ID and shift timings. Every time a patient visits, a medical record is created that stores the visit date , diagnosis , and treatment prescribed. Appointments are scheduled between patients and doctors, recording the appointment date and time. 

 🎓 School Management

 The school enrolls many students , each with a student ID , name , grade , and date of birth. Teachers are assigned to different departments and have a teacher ID , name , and subject specialty. Students register for courses , which have a course ID , course name , and credits. For every course, grades are recorded that include the exam date and marks obtained. 

 💰 Banking System

 The bank has many customers , each with a customer ID , name , and address. Customers hold one or more accounts , with each account having an account

number , account type (savings or checking), and balance. The bank records transactions for accounts, including the transaction ID , date , amount , and transaction type (deposit or withdrawal). Bank employees, identified by an employee ID and name , manage customer services. Customers can also apply for loans , which include a loan ID , loan amount , and interest rate. 

 📚 Library System

 The library holds many books , each with a book ID , title , author , and genre. Registered members have a membership ID , name , and contact information. When a member borrows a book, a loan record is created with the loan date , due date , and return date. Members can also place reservations on books, which record the reservation date. Scenario for Attribute Identification: Online Shopping An online shopping website sells various products. Each product has a name , price , product ID , and category. Customers create accounts with their username , email address , and shipping address. When customers place an order , the system records the order ID , date , list of products purchased , and the total amount. The website also tracks delivery agents who handle shipping, recording their name and contact number. You can give students this paragraph and ask them to:

  1. List the entities they find.
  2. For each entity, list the attributes (the details/properties described). Database Detective Worksheet Dataset: Library Members MemberID Name Age MembershipType 101 Alice 25 Regular 102 Bob 30 Premium 103 Charlie 22 Regular Questions:
  3. What is the relation in this dataset? Answer: ________________________________________
  4. List the schema of this relation (attributes and their data types):