Chapter 5 - Chapter 5 Integrity Constraints 1. Integrity...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Chapter 5 Integrity Constraints 1. Integrity constraints provide a way of ensuring that changes made to the database by authorized users do not result in a loss of data consistency. 2. We saw a form of integrity constraint with E-R models: o key declarations: stipulation that certain attributes form a candidate key for the entity set. o form of a relationship: mapping cardinalities 1-1, 1-many and many- many. 3. An integrity constraint can be any arbitrary predicate applied to the database. 4. They may be costly to evaluate, so we will only consider integrity constraints that can be tested with minimal overhead. Domain Constraints o Domain Types o Domain Types in SQL o Null Values Referential Integrity o Basic Concepts o Referential Integrity in the E-R Model o Database Modification o Referential Integrity in SQL Functional Dependencies o Basic Concepts o Closure of a Set of Functional Dependencies o Closure of Attribute Sets o Canonical Cover Assertions Triggers Domain Constraints A domain of possible values should be associated with every attribute. These domain constraints are the most basic form of integrity constraint. They are easy to test for when data is entered. Domain Types Domain Types in SQL Null Values Domain Types 1. Attributes may have the same domain, e.g. cname and employee-name . 2. It is not as clear whether bname and cname domains ought to be distinct. 3. At the implementation level, they are both character strings. 4. At the conceptual level, we do not expect customers to have the same names as branches, in general. 5. Strong typing of domains allows us to test for values inserted, and whether queries make sense. Domain Types in SQL 1. SQL standard supports a restricted set of domain types: o Fixed length character string , user-specified length. o Fixed point number , user-specified precision. o Integer , machine dependent precision. o Small integer , machine dependent subset of integer type. o Floating point , user-specified precision. o Floating point and double precision floating point with machine dependent precision. 2. Some SQL implementations include date type. This allows operations on dates, e.g. . 3. Comparisons between compatible domains are usually allowed. To compare an integer and a small integer, the small integer is cast as an integer. This is known as type coercion . Domain Types in SQL 1. SQL standard supports a restricted set of domain types: o Fixed length character string , user-specified length. o Fixed point number , user-specified precision. o Integer , machine dependent precision. o Small integer , machine dependent subset of integer type. o Floating point , user-specified precision. o Floating point and double precision floating point with machine dependent precision....
View Full Document

Page1 / 13

Chapter 5 - Chapter 5 Integrity Constraints 1. Integrity...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online