0% found this document useful (0 votes)
15 views20 pages

CH # 2 (DBMS)

Data models are essential for organizing data to enhance storage, retrieval, and analysis, ensuring data consistency and integrity while supporting decision-making. Business rules define the policies and procedures that guide data requirements and relationships within an organization. The document also discusses the relational data model, its features, and the importance of object-oriented data models, along with the challenges and characteristics of big data.

Uploaded by

parinaveed876
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views20 pages

CH # 2 (DBMS)

Data models are essential for organizing data to enhance storage, retrieval, and analysis, ensuring data consistency and integrity while supporting decision-making. Business rules define the policies and procedures that guide data requirements and relationships within an organization. The document also discusses the relational data model, its features, and the importance of object-oriented data models, along with the challenges and characteristics of big data.

Uploaded by

parinaveed876
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Importance of Data models?

Data models are crucial for organizing and structuring data in a way that supports efficient
storage, retrieval, and analysis. They help ensure data consistency, reduce redundancy, and
improve data integrity. A well-designed data model also facilitates better decision-making by
providing a clear understanding of the relationships between different data entities.

Some key benefits of data models include:

 Improved data quality


 Enhanced scalability
 Better data integration
 Simplified data analysis
 better decision-making
 Increased efficiency

Data models are widely used in various industries, including finance, healthcare, and e-
commerce, to manage complex data systems and drive business insights.

2. What is a business rule, and what is its purpose in data modeling?

Business Rule: .-----(( A business rule is a brief, precise, and unambiguous description of a
policy, procedure, or principle within a specific organization. In a sense, business rules are
misnamed: they apply to any organization, large or small—a business, a government unit, a
religious group, or a research laboratory—that stores and uses data to generate
information.))-------
A business rule is a formal statement that defines or constrains some aspect of a business. It
describes operations, definitions, or constraints that apply to an organization’s data and
processes.

Purpose in Data Modeling:

 Defines Data Requirements: Helps identify what data is needed and how it should be
used.

 Ensures Accuracy: Ensures the data stored reflects real-world situations accurately.

 Guides Model Structure: Helps create relationships between entities (e.g., "A customer
can place many orders").

 Supports Consistency: Keeps the database consistent with the organization's policies
and procedures.
3. How do you translate business rules into data model components?

Business rules are translated into the components of a data model by identifying:

Business Rule Example Data Model Component

"Each student has one ID" Attribute: StudentID (Primary Key)

Relationship: One-to-Many between Student and


"A student can enroll in many courses"
Course

"A course must be taught by a


Entity: Professor, Relationship with Course
professor"

"Employee salary must be positive" Constraint: CHECK constraint on Salary

Steps:

1. Identify Entities (nouns like Student, Course, Employee).

2. Identify Relationships (verbs or actions like enrolls in, teaches).

3. Identify Attributes (properties like Name, Salary, Date).

4. Apply Constraints (rules like uniqueness, not null, valid ranges).

4. Describe the basic features of the relational data model and discuss their importance to the
end user and the designer.

Basic Features of the Relational Data Model:

1. Tables (Relations):

o Data is stored in tables (rows and columns).

o Each table represents an entity.

2. Rows (Tuples):

o Each row in a table represents a single record.

3. Columns (Attributes):

o Each column stores a specific type of data (e.g., Name, Date).

4. Primary Key:
o A unique identifier for each record in a table.

5. Foreign Key:

o A field that creates a relationship between two tables.

6. Data Integrity:

o Enforces accuracy and consistency using keys and constraints.

7. SQL (Structured Query Language):

o Standard language to query and manipulate relational databases.

Importance to End Users:

 User-Friendly Structure: Easy to understand data stored in rows and columns.

 Data Access: Can retrieve and manipulate data using simple queries.

 Consistency: Ensures that users get reliable and accurate data.

Importance to Designers:

 Modularity: Easy to design, expand, and maintain.

 Normalization: Helps remove redundancy and improve efficiency.

 Data Integrity: Ensures consistent data relationships through constraints and keys.

 Security: Access can be controlled at table, column, or row level.

5. How did the ER model help create a more structured relational database design
environment?

 The Entity-Relationship (ER) model provides a visual and conceptual tool for designing
databases.

 It helps identify entities, attributes, and relationships before creating tables.

 Encourages a structured approach by mapping real-world concepts into models that


later convert into relational tables.

 Reduces redundancy and enhances data integrity.


6. ERD for: "A customer can make many payments, but each payment is made by only one
customer."

Entities:

 Customer (CustomerID, Name, etc.)

 Payment (PaymentID, Amount, Date, etc.)

Relationship:

 One-to-Many (Customer to Payment)

ERD (Crow’s Foot Notation):

Customer ─────< makes >──── Payment

[CustomerID] [PaymentID]

7. Why does an object have greater semantic content than an entity?

 An object in OODM includes attributes, behavior (methods), and identity.

 An entity in ER models only includes attributes and relationships.

 Objects represent more complex real-world concepts, including how data behaves.

8. Difference between object and class in OODM?

 Class: A blueprint that defines attributes and methods.

 Object: An instance of a class, containing actual data and the ability to perform
behaviors.

8. Modeling Q6 with OODM (Object-Oriented Data Model)


 Classes: Customer and Payment

 Customer has a collection of Payment objects.

 Payment has a reference to one Customer.

Class: Customer

Attributes: CustomerID, Name, etc.

Methods: makePayment()

Class: Payment

Attributes: PaymentID, Amount, Date

Methods: getDetails()

Association: Payment ---> Customer (1:1), Customer ---> Payment (1:M)

OR
Great! Let’s solve Question #9 using the reference from:

 Question #6:
“A customer can make many payments, but each payment is made by only one customer.”

 Figure 2.4:
A visual comparison of how the same conceptual model is represented in:

1. Object-Oriented (OO) Model


2. UML Class Diagram

3. Entity-Relationship (ER) Model

✅ Question #9: OODM Representation (Based on Q#6 and Fig 2.4)

We’ll now model the Customer–Payment relationship as shown in Figure 2.4’s three-part comparison
(OO, UML, ER), but using “Payment” instead of “Invoice”.

🔷 1. Object-Oriented Representation (OO)

PAYMENT

────────────────────────────

PAYMENT_DATE

PAYMENT_AMOUNT

PAYMENT_METHOD

CUSTOMER 1

PAYMENT M

 This shows that 1 Customer is associated with many Payments.

 The PAYMENT object has its own attributes.

🔶 2. UML Class Diagram

+----------------+ +--------------------------+

| CUSTOMER |1 *| PAYMENT |

+----------------+-------+--------------------------+

| | | PAYMENT_DATE : Date |

| | | PAYMENT_AMOUNT : Double |

| | | PAYMENT_METHOD : String |

+----------------+ +--------------------------+

| ^
| |

makes made by

 Shows a 1-to-many (1..*) association from Customer to Payment.

 Payment has three attributes with their types.

 Optional labels like “makes” and “made by” describe the direction.

🔷 3. ER Model

 Entities: CUSTOMER, PAYMENT

 Relationship: makes

 Cardinality:

o CUSTOMER (1)

o PAYMENT (M)

+-----------+ +--------------------+

| CUSTOMER |◄──────────▶| PAYMENT |

+-----------+ makes +--------------------+

| PAYMENT_DATE |

| PAYMENT_AMOUNT |

| PAYMENT_METHOD |

+--------------------+

 The relationship "makes" connects Customer to Payment.

 One customer can make many payments.

 Each payment is made by exactly one customer.

10. What is ERDM and its role?

 ERDM = Extended Relational Data Model

 Combines relational model with object-oriented features (e.g., inheritance, complex


data types).
 Used in modern DBMSs to support complex applications (e.g., multimedia, CAD
systems).

11. What is a relationship, and its types?

 A relationship describes how entities are connected. ( A relationship is an association


among (two or more) entities.)

 Types:

1. One-to-One (1:1)

2. One-to-Many (1:M)

3. Many-to-Many (M:N)

12. Examples of each relationship type:

 1:1: Each person has one passport.

 1:M: One teacher teaches many students.

 M:N: Students enroll in many courses, and each course has many students.

13. What is a table, and its role in the relational model?

 A table (relation) is a collection of rows and columns that stores data.

 Each table represents an entity.

 Central structure for organizing and retrieving data using SQL.

14. What is a relational diagram?

 A relational diagram visually shows tables and their relationships using keys.

 Example:

Customer [CustomerID PK]

Payment [PaymentID PK, CustomerID FK]


15. What is connectivity?

 Connectivity refers to the type of relationship between entities:

o 1:1, 1:M, or M:N

 Crow’s Foot Notation:

Customer ─────< makes >──── Payment

(1:M relationship shown with one line on left and crow’s foot on right)

16. Describe the Big Data phenomenon

 Big Data involves extremely large and complex data sets that traditional databases can't
handle.

 Big Data refers to a movement to find new and better ways to manage large amounts of
web-generated data and derive business insight from it, while, at the same time,
providing high performance and scalability at a reasonable cost

 It's used in areas like analytics, AI, and real-time decision-making.

17. What does the term 3 Vs refer to?

 Volume – Large amounts of data

 Velocity – Speed of data generation

 Variety – Different data types (text, video, logs, etc.)

(Some add a 4th V: Veracity – data accuracy)

18. What is Hadoop and its basic components?

 Hadoop is an open-source framework for processing large datasets. Hadoop is a Java


based, open source, high speed, fault-tolerant distributed storage and computational
framework.

 Components:
1. HDFS – Hadoop Distributed File System (storage) designed to manage large
amounts of data at high speeds.

2. MapReduce – Programming model for processing (open-source API (Application


programming interface) that provides fast data analytics services.)

3. YARN – Resource manager

4. Hadoop Common – Shared utilities

19. Basic characteristics of a NoSQL database:

 Schema-less: Flexible data models

 Scalable: Handles big, distributed data

 Types: Key-value, document, column, graph

 Designed for: Unstructured/semi-structured data and fast access

20. Modeling Medical Clinic (Relational vs. Key-Value)

Relational Model:

Table: Patient [PatientID, Name]

Table: Test [TestID, TestName, PatientID FK]

Key-Value Model:

"Patient:123": {

"Name": "Ali",

"Tests": [

{"TestID": "T01", "TestName": "Blood Test"},

{"TestID": "T02", "TestName": "X-Ray"}

21. What is logical independence?


 Ability to change the logical schema (e.g., table structure) without affecting
applications.

22. What is physical independence?

 Ability to change the physical storage (e.g., indexing, partitioning) without affecting the
logical schema or application.

Problems
Thanks! To answer your questions about Problems 1–5 using Figure 2.1 and Figure P2.4, I’ll explain
based on standard textbook versions (commonly used in courses like yours). Since I can’t view the
actual figures you referenced, I’ll describe typical contents of Figure 2.1 and Figure P2.4 from
Cengage’s Database Systems (12th or 13th Edition), often used in your course.

If your version is different, feel free to upload a screenshot or describe the diagram!

Problem 1: Business Rules between AGENT and CUSTOMER

Based on Figure 2.1 (commonly shows AGENT and CUSTOMER tables):

Business Rules:

1. An agent can serve many customers.

2. Each customer is served by one agent.

This is a one-to-many (1:M) relationship from AGENT to CUSTOMER.

Problem 2: Basic Crow’s Foot ERD

Crow’s Foot Notation:


AGENT ─────< serves >──── CUSTOMER

[AgentID] (PK) [CustomerID] (PK)

[AgentID] (FK)

 One line from AGENT to many (crow’s foot) at CUSTOMER.

 Indicates 1:M relationship.

Problem 3: Object Representation and UML Class Diagram

Object-Oriented Representation:

Class: Agent

 Attributes: AgentID, Name, etc.

 Methods: assignCustomer(), getCustomerList()

Class: Customer

 Attributes: CustomerID, Name, etc.

 Methods: contactAgent(), getAgentInfo()

 Has reference to one Agent

UML Class Diagram (simplified):

+----------------+ 1 * +------------------+

| Agent |-------------------->| Customer |

|----------------| |------------------|

| AgentID | | CustomerID |

| Name | | Name |

+----------------+ +------------------+

Problems 4–5: Based on Figure P2.4 - DealCo Relational Diagram

Let’s assume the following simplified version of the DealCo diagram:

REGION(RegionID, RegionName)

STORE(StoreID, StoreName, RegionID)


EMPLOYEE(EmployeeID, EmpName, StoreID)

Problem 4: Identify each relationship type and write the business rules

1. REGION to STORE

 1:M relationship

 Business Rule: One region can contain many stores, but each store is located in only one
region.

2. STORE to EMPLOYEE

 1:M relationship

 Business Rule: One store can have many employees, but each employee works at one store.

If your diagrams include more entities or attributes, just upload or describe them, and I’ll update this
with exact answers and diagrams!

Would you like me to draw the ERD or UML diagrams for you visually?

You're tackling a deep set of exercises—great job sticking with it! Since these are textbook problems
that reference figures like P2.4, P2.6, etc., which I can't directly see, I’ll continue helping based on
standard versions of these diagrams commonly found in the Database Systems textbook by Coronel &
Morris.

Let’s start with Problems 5 to 12, and I’ll break them down for you step by step:

5. Basic Crow’s Foot ERD for DealCo

Assuming the structure is:

 REGION (RegionID, RegionName)

 STORE (StoreID, StoreName, RegionID)

 EMPLOYEE (EmployeeID, EmpName, StoreID)

Crow’s Foot ERD:

REGION ─────< STORE ─────< EMPLOYEE

[RegionID] [StoreID] [EmployeeID]

[RegionID] [StoreID]
 REGION to STORE → 1:M

 STORE to EMPLOYEE → 1:M

6. Tiny College Business Rules (based on Figure P2.6)

Common entities: STUDENT, COURSE, PROFESSOR, CLASS, ENROLLMENT, DEPARTMENT

Business Rules:

1. A student can enroll in many classes, but each class can have many students → M:N (resolved
via ENROLLMENT).

2. A professor teaches many classes, but each class is taught by one professor → 1:M.

3. A course can generate many classes, but each class is for only one course → 1:M.

4. A department offers many courses and has many professors, but each course and professor
belongs to one department → 1:M.

7. Crow’s Foot ERD for Tiny College

Simplified ERD:

STUDENT ─────< ENROLLMENT >───── CLASS >──── COURSE >──── DEPARTMENT

^ ^

| |

PROFESSOR ─────> DEPARTMENT

8. UML Class Diagram for Tiny College

Simplified structure:

+----------------+ +----------------+ +----------------+

| Student | | Class | | Professor |

|----------------| |----------------| |-----------------|

| studentID | | classID | | professorID |

+----------------+ +----------------+ +-----------------+


+----------------+ +----------------+ +----------------+

| Enrollment | | Course | | Department |

|----------------| |----------------| |-----------------|

| studentID (FK) | | courseID | | departmentID |

| classID (FK) | | departmentID | | name |

+----------------+ +----------------+ +----------------+

9. Hospital Example (PATIENT, ORDER, MEDICATION)

a. Business Rules:

 A patient can place many orders → 1:M

 Each order is for one patient.

 An order can include many medications → 1:M

 Each medication belongs to one order.

b. Crow’s Foot ERD:

PATIENT ─────< ORDER ─────< MEDICATION

[PatientID] [OrderID] [MedicationID]

[PatientID] [OrderID]

10. United Broke Artists (UBA)

a. Tables:

 PAINTER (PainterID, Name, Style)

 PAINTING (PaintingID, Title, Year, PainterID, GalleryID)

 GALLERY (GalleryID, Name, Location)

b. Relationships:

 Each painting is created by one painter → 1:M from PAINTER to PAINTING

 Each painting is exhibited in one gallery → 1:M from GALLERY to PAINTING


11. Relational Schema for UBA

PAINTER(PainterID PK, Name, Style)

PAINTING(PaintingID PK, Title, Year, PainterID FK, GalleryID FK)

GALLERY(GalleryID PK, Name, Location)

12. UML Class Diagram for UBA

+----------------+ +----------------+ +----------------+

| Painter |1 *| Painting |* 1| Gallery |

|----------------|-------|----------------|-------|----------------|

| PainterID | | PaintingID | | GalleryID |

| Name | | Title | | Name |

| Style | | Year | | Location |

+----------------+ | PainterID (FK) | +----------------+

| GalleryID (FK) |

+----------------+

Would you like me to go ahead and create the diagrams for Problems 13 to 17 too?

Or if you want the actual visual ERDs or UML diagrams, I can generate those as images!

Ah, got it! Thanks for pointing that out. Let’s continue from Problem 13 onward, based on your
textbook and image. Here's the detailed solution:

Problem 13 – Business Rules from Figure P2.13

Since the figure isn't provided here, we’ll proceed with a general format to help you describe such
ERDs in the future.

To answer this, you should:

1. Identify all entities.

2. Check relationship lines: one-to-many (1:M), many-to-many (M:N), or one-to-one (1:1).

3. Look at verb phrases (like "writes", "receives") and determine cardinalities.


If you want, you can upload the image of Figure P2.13, and I’ll describe it exactly.

Problem 14 – Create a Crow’s Foot ERD for ProdCo

Business Rules:

a. Each sales representative writes many invoices.


b. Each invoice is written by one sales representative.
c. Each sales representative is assigned to one department.
d. Each department has many sales representatives.
e. Each customer can generate many invoices.
f. Each invoice is generated by one customer.

ERD Relationships:

 DEPARTMENT (1) —— (M) SALES_REPRESENTATIVE

 SALES_REPRESENTATIVE (1) —— (M) INVOICE

 CUSTOMER (1) —— (M) INVOICE

Problem 15 – Business Rules from Figure P2.15

(You can upload the image if you'd like an exact answer from the figure.)

Assuming it’s about books, authors, and publishers (as typical in P2.15), the business rules might be:

1. Each author writes many books.

2. Each book is written by one author.

3. Each book is published by one publisher.

4. A publisher publishes many books.

Great! Let’s now work through Problems 16 and 17 using the content from the image you provided.

Problem 16 – Crow’s Foot ERDs for Business Descriptions

Let’s convert each description into business rules and outline the corresponding Crow’s Foot ERD
relationships:

a. MegaCo Corporation
Business Rules:

 A division has many departments.

 A department belongs to one division.

 A department has many employees.

 An employee works for one department.

 A department is managed by one employee.

 One employee manages only one department at a time.

Relationships:

 DIVISION (1) —— (M) DEPARTMENT

 DEPARTMENT (1) —— (M) EMPLOYEE

 EMPLOYEE (1) —— (1) DEPARTMENT (Manager relationship)

b. BooksOnline Downloads

Business Rules:

 A customer can download many ebooks.

 An ebook can be downloaded by many customers.

Relationship:

 CUSTOMER (M) —— (M) EBOOK (This is a many-to-many relationship, which may require a
junction table like DOWNLOAD.)

c. Airliner Flights

Business Rules:

 An airliner can fly many flights.

 Each flight is flown by one airliner.

Relationship:

 AIRLINER (1) —— (M) FLIGHT

d. KwikTite Corporation
Business Rules:

 A region has many factories.

 Each factory is located in one region.

 A factory employs many employees.

 Each employee works for one factory.

Relationships:

 REGION (1) —— (M) FACTORY

 FACTORY (1) —— (M) EMPLOYEE

e. Employees and Degrees

Business Rules:

 An employee can earn many degrees.

 A degree may be earned by many employees.

Relationship:

 EMPLOYEE (M) —— (M) DEGREE (This is another many-to-many relationship.)

Problem 17 – Business Rules in Figure P2.17

Based on the ERD shown in Figure P2.17:

Entities:

 THEATER

 MOVIE

 REVIEW

 REVIEWER

Business Rules from the diagram:

1. A theater shows many movies.

2. A movie is shown at one theater.

3. A movie receives many reviews.


4. A review is written for one movie.

5. A reviewer writes many reviews.

6. A review is written by one reviewer.

Relationships:

 THEATER (1) —— (M) MOVIE

 MOVIE (1) —— (M) REVIEW

 REVIEWER (1) —— (M) REVIEW

Based on the Entity Relationship Diagram (ERD) shown in Figure P2.17, the following business rules
are reflected:

1. **Theater shows Movies**: The ERD shows a one-to-many relationship between the "THEATER"
and "MOVIE" entities, indicating that a theater can show multiple movies.

2. **Reviewer writes Reviews**: The ERD shows a one-to-many relationship between the "REVIEWER"
and "REVIEW" entities, indicating that a reviewer can write multiple reviews.

3. **Reviews are written for Movies**: The ERD shows a one-to-many relationship between the
"MOVIE" and "REVIEW" entities, indicating that a movie can have multiple reviews written for it.

4. **Reviewers receive Movies**: The ERD shows a one-to-many relationship between the "MOVIE"
and "REVIEWER" entities, indicating that a reviewer can receive multiple movies.

In summary, the key business rules reflected in the ERD are:

1. Theaters show movies

2. Reviewers write reviews

3. Reviews are written for movies

4. Reviewers receive movies

You might also like