Sei sulla pagina 1di 7

DOMAIN

CONSTRAINTS
ASYIREEN IZZUAN BIN ALIAS
KHALED ALAMERI

ALLPPT.com _ Free PowerPoint Templates, Diagrams and Charts


A. Domain Constraints
• Domain constraints include entity integrity and referential integrity;
• The domain is set of values that may be assigned to an attribute;
• Entity integrity rule - primary key cannot be null;
• Referential integrity - foreign key value must match a primary key value
or be null;
• Each table set of columns
• Each column allows same type of data (based on its data type);
• Column doesn’t accept other data values;
• Domain constraints deal with one or more columns to ensure that the
particular column or set of columns meets particular criteria;
• When insert or update a row, constraint is applied without respect to
any other row in the table;
A. Domain Constraints
Referential Integrity Constraint
Orders Table Domain Constraint
Order ID
Column
Order ID Line Item Part Number Unit Price
1 1 0P12400 90.00

2 1 8L21210 85.46 Entity


Constraint
3 1 9A78800 140.00

3 2 1R55640 .70

4 1 2Q77980 425.00

5 1 7Y00124 29.75

• Domain constraint is used to confine UnitPrice column to values that are


greater than or equal to zero;
• Although any row with UnitPrice that didn't meet the constraint would be
rejected, so integrity is enforced to make sure entire column meets
the constraint;
• The domain is the column, and the constraint is a domain constraint; and
• This kind of constraint is used when dealing with CHECK constraints, rules,
defaults, and DEFAULT constraints.
A. Domain Constraints

Three distinct rules can be designed to check the validity of states, actions,
and terminators in accordance with the state-transition model:

i. State domain constraint - Limits the set of allowed states to only those shown in
the state-relational model.
ii. Action domain constraint - Limits the set of allowed actions to only those shown
in the state-relational model.
iii. Terminator domain constraint - Limits the set of allowed terminators which
refer to states in which an object can start
and end its life cycle.
A. Domain Constraints

For the password state-transition model discussed in this diagram, the domain
constraints take the following form:

• State domain consists of seven values: Start (S), First Try (1st T), Second Try
(2nd T), Third Try (3rd T), Fourth Try (4th T), Close Application (CA), Access (A).
• Action domain consists of three values: Enter Agent Name, Incorrect
Password, Correct Password
• Only Access (A) state is allowed to access.
Agent history data that violates all three constraints

PasswordNu LoginTime LogoutTime ActionCode StateCod


mber e
6911 9:45PM 9:50PM Incorrect (A) (3)
Password
72&T 11:15PM 11:20PM Correct (A)
Password
1423 4:05PM 4:19PM Incorrect (S) (1)
Password
1234 6:18:AM 6:26AM Incorrect (CA)
Password
12#V 6:30AM 6:40 Coroect (A) (2)
Password

• The record marked (1) has invalid stat code, likely a typo.
• The record marked (2) has invalid action cod Coroect Password, also a typo.
• The record marked (3) is the Incorrect Password and must have state code (CA)
THANK YOU

ALLPPT.com _ Free PowerPoint Templates, Diagrams and Charts

Potrebbero piacerti anche