06-02-2012, 02:45 PM
Data Modeling(CB 12)
CPSC 356 Database
Ellen Walker
Hiram College
Describing the Data
DDL (Data Definition Language)
Detailed definition of database schema
Too low-level (and database-specific) for good modeling!
Record-based model (relational)
Better, but DBMS dependent
Object-based model (entity-relationship)
This is the level to start at!
Entity-Relationship (ER) Modeling
Entity
Object (in the C++ sense); “thing”; noun
Attribute
Property of an object ; “variable”; adjective
Relationship
Association among entities; verb
Relationship vs. Relation
A relationship (in ER modeling) describes the connection (often a verb) between two or more entities
A relation (in a relational database) is a table, or a set of tuples (rows).
Both entities and relationships in the ER can map to relations in the RDB
Not all relationships in the ER map to relations in the RDB
Entity vs. Relation
An Entity (in ER modeling) nearly always maps to a Relation (in the RDB)
A Relation in the RDB does not always maps to an Entity in the ER
Common problem: designing your ER diagram as if it were an RDB - don’t think about tables yet!
Type vs. Instance
Entity type -- a class of entity, e.g. Student
Entity instance (occurrence) -- a specific entity, e.g. “Student number 123456”
Shortcut: “entity” means “entity instance”
Relationships also have type vs. instance
Databases have schema vs. instance