Database Design
Database Design
• Database design is the organization of data according
to a database model.
• A database model is a type of data model that
determines the logical structure of a database and
fundamentally determines in which manner data can
be stored, organized and manipulated.
– Ex: relational model, which uses a table-based format.
Database Design
• The designer determines what data must be
stored and how the data elements interrelate.
• Database design involves classifying data and
identifying interrelationships.
Relational model
• It is a mathematical model defined in terms of
predicate logic and set theory, and
implementations of it have been used by
mainframe, midrange and microcomputer
systems.
• The products that are generally referred to as
relational databases.
– Ex: RDBMS
Entity Relationship Diagram
ERD
What is an ERD?
• An entity relationship diagram (ERD) shows the
relationships of entity sets stored in a database.
• An entity in this context is an object, a
component of data.
• An entity set is a collection of similar entities.
• These entities can have attributes that define its
properties.
What is an ERD?
• By defining the entities, their attributes, and
showing the relationships between them, an ER
diagram illustrates the logical structure of
databases.
• ER diagrams are used to sketch out the design of
a database.
Database Relationships
Table 1. Database relationships
Type of relationship Description
One-to-one Both tables can have only one record on each side of the relationship.
Each primary key value relates to none or only one record in the related table.
Most one-to-one relationships are forced by business rules and do not flow naturally from the data.
Without such a rule, you can typically combine both tables without breaking any normalization rules.
One-to-many The primary key table contains only one record that relates to none, one, or many records in the related
table.
Many-to-many Each record in both tables can relate to none or any number of records in the other table. These
relationships require a third table, called an associate or linking table, because relational systems cannot
directly accommodate the relationship.