0% found this document useful (0 votes)
149 views

Lct2 - Data Model in Database&DBMS

1. Data modeling is important as it clarifies communication by reducing database design complexities to more easily understood abstractions that define entities and relations. 2. Business rules are precise descriptions of organizational policies and procedures that help properly identify entities, attributes, relationships, and constraints in data modeling. 3. The relational data model and ER diagrams graphically represent entities, attributes, relationships, and constraints to translate business rules into the components of a data model.

Uploaded by

Jackton Brian
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
149 views

Lct2 - Data Model in Database&DBMS

1. Data modeling is important as it clarifies communication by reducing database design complexities to more easily understood abstractions that define entities and relations. 2. Business rules are precise descriptions of organizational policies and procedures that help properly identify entities, attributes, relationships, and constraints in data modeling. 3. The relational data model and ER diagrams graphically represent entities, attributes, relationships, and constraints to translate business rules into the components of a data model.

Uploaded by

Jackton Brian
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

INTRODUCTION

 Data modeling is the first step in the database design journey, serving as a bridge between
real-world objects and the database that resides in the computer.
 Data modeling clarifies such communication by reducing the complexities of database
design to more easily understood abstractions that define entities and the relations among
them.
 Data modeling, refers to the process of creating a specific data model for a determined
problem domain.
 (A problem domain is a clearly defined area within the real-world environment, with well-
defined scope and boundaries, that is to be systematically addressed.)
 A data model is a relatively simple representation, usually graphical, of more complex real-
world data structures.
The basic building blocks of all data models are entities, attributes, relationships, and constraints.

1) An entity is anything (a person, a place, a thing, or an event) about which data are to be collected
and stored.
 An entity represents a particular type of object in the real world. Because an entity represents a
particular type of object, entities are “distinguishable”—that is, each entity occurrence is unique and
distinct.
 For example, a CUSTOMER entity would have many distinguishable customer occurrences, such
as John Smith, Pedro Dinamita, Tom Strickland, etc.
 Entities may be physical objects, such as customers or products, but entities may also be
abstractions, such as flight routes or musical concerts.
The basic building blocks of all data models are entities, attributes, relationships, and constraints.

2) An attribute is a characteristic of an entity.


 For example, a CUSTOMER entity would be described by attributes such as customer last name,
customer first name, customer phone, customer address, and customer credit limit.
 Attributes are the equivalent of fields in file systems

3) A relationship describes an association among entities.


 For example, a relationship exists between customers and agents that can be described as follows:
 An agent can serve many customers, and each customer may be served by one agent.
 Data models use three types of relationships:
a) one-to-many, (1:M or 1..*,)
b) many-to-many, (M :N or*..*, )
c) one-to-one. (1:1 or 1..1, )
(Although the M:N notation is a standard label for the many-to-many relationship, the label M:M may
also be used.)
 One-to-many (1:M or 1..*) relationship. A painter paints many different paintings, but each one
of them is painted by only one painter. Thus, the painter (the “one”) is related to the paintings (the
“many”). Therefore, database designers label the relationship “PAINTER paints PAINTING” as
1:M. (Note that entity names are often capitalized as a convention, so they are easily identified.)
Similarly, a customer (the “one”) may generate many invoices, but each invoice (the “many”) is
generated by only a single customer. The “CUSTOMER generates INVOICE” relationship would
also be labeled 1:M.

 Many-to-many (M:N or *..*) relationship. An employee may learn many job skills, and each job
skill may be learned by many employees. Database designers label the relationship “EMPLOYEE
learns SKILL” as M:N. Similarly, a student can take many classes and each class can be taken by
many students, thus yielding the M:N relationship label for the relationship expressed by
“STUDENT takes CLASS.”

 One-to-one (1:1 or 1..1) relationship. A retail company’s management structure may require that
each of its stores be managed by a single employee. In turn, each store manager, who is an
employee, manages only a single store. Therefore, the relationship “EMPLOYEE manages STORE”
4). A constraint is a restriction placed on the data.
 Constraints are important because they help to ensure data integrity.
 Constraints are normally expressed in the form of rules.
 For example:
 An employee’s salary must have values that are between 6,000 and 350,000.
 A student’s GPA must be between 0.00 and 5.00.
 Each class must have one and only one teacher.
A Business Rules

How do you properly identify entities, attributes, relationships, and constraints?


 The first step is to clearly identify the business rules for the problem domain you are modeling.
 A business rule is a brief, precise, and unambiguous description of a policy, procedure, or principle
within a specific organization.
 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.
 Business rules must be rendered in writing and updated to reflect any change in the organization’s
operational environment.
 Properly written business rules are used to define entities, attributes, relationships, and constraints.
Any time you see relationship statements such as “an agent can serve many customers, and each
customer can be served by only one agent,” you are seeing business rules at work.
 The main sources of business rules are company managers, policy makers, department managers,
and written documentation such as a company’s procedures, standards, and operations manuals
 The relational model was introduced in 1970 by E. F. Codd (of IBM) in his landmark paper “A
Relational Model of Data for Large Shared Databanks” (Communications of the ACM, June 1970,
pp. 377−387).
 The relational model represented a major breakthrough for both users and designers.
 The relational model also describes a precise set of data manipulation constructs based on advanced
mathematical concepts
 Think of a relation (sometimes called a table) as a matrix composed of intersecting rows and
columns.
 Each row in a relation is called a tuple.
 Each column represents an attribute.
 Relational database software include as Oracle, DB2, Microsoft SQL Server, MySQL,
 The relational data model is implemented through a very sophisticated relational database
management system (RDBMS).
 Advantage of the RDBMS is its ability to hide the complexities of the relational model from the
user.
 The RDBMS manages all of the physical details, while the user sees the relational database as a
collection of tables in which data are stored.
 View the Tables below (Agents & Customers)
 In the CUSTOMER table above, it contain a sales agent’s number that is also contained in the
AGENT table.
 Therefore the common link between the CUSTOMER and AGENT tables enables you to match the
customer to his or her sales agent, even though the customer data are stored in one table and the
sales representative data are stored in another table.
 For example, you can easily determine that customer Dunne’s agent is Alex Alby because for
customer Dunne, the CUSTOMER table’s AGENT_CODE is 501, which matches the AGENT
table’s AGENT_CODE for Alex Alby. Although the tables are independent of one another, you can
easily associate the data between tables
 A relational diagram is a representation of the relational database’s entities, the attributes within
those entities, and the relationships between those entities.
 The relational diagram below shows the connecting fields (in this case, AGENT_CODE) and the
relationship type, 1:M. Microsoft Access, the database software application used to generate
 The ∞(infinity) symbol used to indicate the “many” side.
 In this example, the CUSTOMER represents the “many” side because an AGENT can have many
CUSTOMERs.
 The AGENT represents the “1” side because each CUSTOMER has only one AGENT.
 Database designers prefer to use a graphical tool in which entities and their relationships are pictured.
 Peter Chen first introduced the ER data model in 1976; it was the graphical representation of entities
and their relationships in a database structure that quickly became popular because it complemented the
relational data model concepts

 The ER model is based on the following components:

1. Entity. An entity was defined as anything about which data are to be collected and stored. An entity is
represented in the ERD by a rectangle, also known as an entity box.
 The name of the entity, a noun, is written in the center of the rectangle.
 The entity name is generally written in capital letters and is written in the singular form: PAINTER
rather than PAINTERS, and EMPLOYEE rather than EMPLOYEES.
 Usually, when applying the ERD to the relational model, an entity is mapped to a relational table.
 Each row in the relational table is known as an entity instance or entity occurrence in the ER model.
 Each entity is described by a set of attributes that describes particular characteristics of the entity. For
example, the entity EMPLOYEE will have attributes such as a Social Security number, a last name,
and a first name.
2. Relationships.
 Relationships describe associations among data.
 Most relationships describe associations between two entities.
 When the basic data model components were introduced, three types of relationships among data were
illustrated: one-to-many (1:M), many-to-many (M:N), and one-to-one (1:1).
 The ER model uses the term connectivity to label the relationship types.
 The name of the relationship is usually an active or passive verb.
 For example, a PAINTER paints many PAINTINGs; an EMPLOYEE learns many SKILLs; an
EMPLOYEE manages a STORE

The ER uses either the original Chen notation and the more current Crow’s Foot notation.
Check the next slide
1. Discuss the importance of data modeling.
2. What is a business rule, and what is its purpose in data modeling?
3. How do you translate business rules into data model components?
4. Describe the basic features of the relational data model and discuss their importance to the end user
and the designer.
5. Explain how the entity relationship (ER) model helped produce a more structured relational database
design environment.
6. Use the scenario described by “A customer can make many payments, but each payment is made by
only one customer” as the basis for an entity relationship diagram (ERD) representation.
7. What is a relationship, and what three types of relationships exist?
8. Give an example of each of the three types of relationships.
9. What is a table, and what role does it play in the relational model?
10. What is a relational diagram? Give an example.
11. What is connectivity? (Use a Crow’s Foot ERD to illustrate connectivity.)
12. Use the image below to answer this questions
a) Identify each relationship type and write all of the business rules.
b) Create the basic Crow’s Foot ERD for DealCo.
13. Use the image below to answer this questions
a) Identify each relationship type and write all of the business rules..
b) Create the basic Crow’s Foot ERD for Tiny College
14. Create a Crow’s Foot ERD to include the following business rules for the KK company:
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.

You might also like