Lct2 - Data Model in Database&DBMS
Lct2 - Data Model in Database&DBMS
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.
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
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.