Transcript CH 10
Database Processing
Eighth Edition
Database
Application
Design
1
Chapter 10
David M. Kroenke
© 2002 by Prentice Hall
Functions of a Database
Application
2
© 2002 by Prentice Hall
Four Basic Functions of
Database Applications
• The four basic functions are common to all
database applications
• These basic functions are
– Create
– Read
– Update
– Delete
• The (unfortunate) acronym for these
functions is CRUD
3
© 2002 by Prentice Hall
Format/Materialize Function
of a Database Application
• The format/materialize function of a
database application involves
designing the appearance of the
database application
4
© 2002 by Prentice Hall
Enforce Constraints
Function of a Database
Application
• Database application constraints
typically involve validating the
format, structure, and/or values of
data.
5
© 2002 by Prentice Hall
Provide Security and Control
Function of a Database
Application
• In that database applications provide
access to many people for many
purposes, the application must
provide security and control
functions. This helps protects the
data from being seen and/or modified
by unauthorized persons.
6
© 2002 by Prentice Hall
Execute Application Logic
Function of a Database
Application
• Database applications satisfy one or
more business function. As such, the
business logic must be embedded into
the database application. These logic
rules and procedures constitute the
execute application logic function of
a database application.
7
© 2002 by Prentice Hall
A View
• A view is a structured list of data
attributes from the entities or
semantic objects defined in the data
model
• A view can be materialized or
formatted as an on-line form or a
hard-copy report
8
© 2002 by Prentice Hall
A View CRUD Functions –
Create
• Create
INSERT INTO CUSTOMER
(CUSTOMER.Name, CUSTOMER.City)
VALUES (NewCust.CUSTOMER.Name,
NewCust.CUSTOMER.City)
9
© 2002 by Prentice Hall
A View CRUD Functions –
Read
• Read
SELECT CUSTOMER.CustomerID,
CUSTOMER.Name
FROM CUSTOMER, WORK
WHERE CUSTOMER.CustomerID =
WORK.CustomerID
10
© 2002 by Prentice Hall
A View CRUD Functions –
Update
• Update
INSERT INTO CUSTOMER
(CUSTOMER.Name, CUSTOMER.City)
VALUES (NewCust.CUSTOMER.Name,
NewCust.CUSTOMER.City)
11
© 2002 by Prentice Hall
A View CRUD Functions –
Delete
• Delete
Cascading
deletions
depend on
relationship
cardinality
12
© 2002 by Prentice Hall
Form Design
• A form should...
– Reflect the underlying structure of
the view
– Make data associations graphically
evident
– Encourage/Guide appropriate user
action/response
13
© 2002 by Prentice Hall
Graphical User Interface
(GUI) Controls
• Drop-down list box
– A drop-down list box provides a list
of items from which the user may
choose
• Option (or radio) button
– A set of option buttons allow the
user to select one of a set of
alternatives
14
© 2002 by Prentice Hall
Graphical User Interface
(GUI) Controls
• Check box
– A check box allows the user to
select or deselect the option.
• Cursor movement/Pervasive Keys
– Cursor movement defines the
behavior of the cursor. The cursor
should move naturally through the
form.
15
© 2002 by Prentice Hall
GUI Example
16
© 2002 by Prentice Hall
Report Design
• The report should...
– Reflect the underlying structure of the
view
– Handle implied objects
• The implied objects are those realworld objects that provide meaning
and purpose to the report and to the
database application
17
© 2002 by Prentice Hall
Enforcing Constraints within
a Database Application
• Domain constraints
• Uniqueness
• Referential
integrity
constraints
18
• Relationship
cardinality
• Business rule
– Triggers
© 2002 by Prentice Hall
Uniqueness Constraint
• The uniqueness constraint
determines if the value within the
attribute must be unique for every
tuple in the relation.
• Uniqueness is referred to as “no
duplicates” within Microsoft Access
19
© 2002 by Prentice Hall
Referential Integrity
Constraint
• Referential integrity defines the role
and treatment of the foreign keys.
• For a foreign key to exist, the value
of the foreign key must appear as a
value in the primary key of the
associated relation.
20
© 2002 by Prentice Hall
Relationship Cardinality
Constraint
• Minimum relationship cardinality
constraint
• Maximum relationship cardinality
constraint
21
© 2002 by Prentice Hall
Minimum Relationship
Cardinality Constraint
• The minimum relationship cardinality
constraint defines whether participation in
a relationship is mandatory or optional
0 = optional
1 = manditory
– A fragment is a parent that does not
have a required child
– An orphan is a child that does not have a
required parent
22
© 2002 by Prentice Hall
Maximum Relationship
Cardinality Constraint
• The maximum relationship
cardinality constraint defines the
maximum level of participation in a
relationship
1 = at most one
N = zero or more
23
© 2002 by Prentice Hall
The Relationship Between the
Minimum and Maximum
Relationship Cardinality
Constraints
• If the minimum cardinality constraint
is optional (0), the maximum
relationship cardinality constraint
would mean:
1 = zero or one
N = zero, one, or more
24
© 2002 by Prentice Hall
The Relationship between the
Minimum and Maximum
Relationship Cardinality
Constraints
• If the minimum cardinality constraint
is mandatory (1), the maximum
relationship cardinality constraint
would mean:
1 = one
N = one or more
25
© 2002 by Prentice Hall
Business Rule Constraints
• Business rule constraints are those
conditions that must be satisfied
based on the rules, practices, and
operating procedures of the
organization.
26
© 2002 by Prentice Hall
Triggers
• Triggers are stored procedures that
are invoked based on an action.
– For instance a stored procedure
may be invoked every time a
record is added to the system.
27
© 2002 by Prentice Hall
Security Functions within a
Database Application
• Typically, security exists on several levels
within a database application
– To log into the system, the user needs
an operating system (e.g., the Windows
username/password)
– To log into the database, the user must
supply a username and password
– To execute the database application, the
user must be granted access to the
appropriate application files
28
© 2002 by Prentice Hall
Horizontal versus Vertical
Security Schemes
• Horizontal security refers to the practice
of restricting access to certain tuples in
the database.
– E.g., you may only see sales data in the
NorthEast
• Vertical security refers to the practice of
restricting access to certain columns in the
database.
– E.g., you may only see the name and
address fields
29
© 2002 by Prentice Hall
Control Functions within a
Database Application
• Typically control functions are introduced
into database applications through menus
and by defining transaction boundaries.
– Using menus, the developer may control
the access for a particular user. This
access may change throughout a user’s
session.
– Transaction boundaries are defined to
coordinate user actions in a multi-user
environment.
30
© 2002 by Prentice Hall
Database Processing
Eighth Edition
Database
Application
Design
31
Chapter 10
David M. Kroenke
© 2002 by Prentice Hall