0% found this document useful (0 votes)
46 views15 pages

Figure: Database Modeling and Implementation Process

The document describes the process of database modeling and implementation, including representing data structures graphically using an entity-relationship diagram with entities, attributes, and relationships; it provides an example ERD for a database about products, companies, and people; and discusses modeling cardinality constraints between entities.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views15 pages

Figure: Database Modeling and Implementation Process

The document describes the process of database modeling and implementation, including representing data structures graphically using an entity-relationship diagram with entities, attributes, and relationships; it provides an example ERD for a database about products, companies, and people; and discusses modeling cardinality constraints between entities.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

 We start with ideas about the information we want to model and

render them in the E/R model. The abstract E/R design is then
converted to a schema in the data-specification language of
some DBMS. Most commonly, this DBMS uses the relational
model.

Figure: Database modeling and implementation process


 The structure of data is represented graphically, as an "entity-
relationship diagram,“ using three principal element types:

1. Entity sets: An entity is an abstract object of some sort, and a


collection of similar entities forms an entity set.

2. Attributes: Entity sets have associated attributes, which are


properties of the entities in that set.

3. Relationships: Relationships are connections among two or


more entity sets.
An E/R diagram is a graph representing entity sets, attributes, and
relationships. Elements of each of these kinds are represented by
nodes of the graph, and we use a special shape of node to indicate
the kind, as follows:
 Entity sets are represented by rectangles.
 Attributes are represented by ovals.
 Relationships are represented by diamonds.
 Edges connect an entity set to its attributes and also connect a
relationship to its entity sets.

Product address buys

Entity Attribute Relation


Product (name, price, category)
Company (name, stockprice)
Person(name, address)

What Would be the ERD?


name category
name

price

Makes Company
Product

stockprice

Buys
Employs

Person

address name
Let us design a database for a Lab, including
information about student and team. Information
about a student includes id, name (e.g., first name,
last name), grade. A team has team number and
grade. We also need to record the student(s) who
form team. A student can be in one team, a team
can have many students. Draw the E/R diagram for
this database.
lastname firstname

name
studentGrade

ID

Forms Team
Student

teamNumber teamGrade
 one-one:
1 a
2 b
3 c
d

1 a
 many-one 2 b
3 c
d

1 a
2 b
 many-many 3 c
d
makes Company
Product

buys
employs

Person
purchaseDate

Product Buys Person


lastname firstname

name name category

studentGrade

ID price

Student Product

18
There are several ways this constraint could be
enforced:

1. We could forbid the deletion of a referenced entity.

2. We could require that if a referenced entity is deleted,


then all entities that reference it are deleted as well.

Student Forms Team

20
Example:
Representing a constraint on the number of students per team

<=5

Student Forms Team

21
Entity sets are weak when their key attributes come from other
classes to which they are related.

This happens if:

- part-of hierarchies
- splitting n-ary relations to binary.

Team affiliation University

sport number name 22


25

You might also like