lecture 3_
lecture 3_
Database design is defined as: "design the logical and physical structure of one
or more databases to accommodate the information needs of the users in an
organization for a defined set of applications". The design process roughly
follows five steps:
The data model is one part of the conceptual design process. The other, typically
is the functional model. The data model focuses on what data should be stored
in the database while the functional model deals with how the data is processed.
To put this in the context of the relational database, the data model is used to
design the relational tables. The functional model is used to design the queries
which will access and perform operations on those tables.
Components of A Data Model
The data model gets its inputs from the planning and analysis
stage. Here the modeler, along with analysts, collects
information about the requirements of the database by
reviewing existing documentation and interviewing end-users.
The data model is one part of the conceptual design process. The
other is the function model.
The data model focuses on what data should be stored in the
database while the function model deals with how the data is
processed. To put this in the context of the relational database, the
data model is used to design the relational tables. The functional
model is used to design the queries that will access and perform
operations on those tables.
Data modeling is preceeded by planning and analysis. The effort
devoted to this stage is proportional to the scope of the database. The
planning and analysis of a database intended to serve the needs of an
enterprise will require more effort than one intended to serve a small
workgroup.
The information needed to build a data model is gathered during the
requirements analysis. Although not formally considered part of the
data modeling stage by some methodologies, in reality the
requirements analysis and the ER diagramming part of the data model
are done at the same time.
Requirements Analysis
The goals of the requirements analysis are:
For example: a student must register for at least three course each
semester
In the case of the specific relationship form (1:1 and 1:M), there is
always a parent entity and a child entity. In one-to-many
relationships, the parent is always the entity with the cardinality of
one. In one-to- one relationships, the choice of the parent entity
must be made in the context of the business being modeled. If a
decision cannot be made, the choice is arbitrary.
Primary and Foreign Keys
Primary and foreign keys are the most basic components on which
relational theory is based.
Primary keys enforce entity integrity by uniquely identifying entity
instances.
Foreign keys enforce referential integrity by completing an
association between two entities. The next step in building the
basic data model to
1. identify and define the primary key attributes for each entity
2. validate primary keys and relationships
3. migrate the primary keys to establish foreign keys
Composite Keys