CHAPTER 7 Ensuring Data Integrity

Constraints and Load Operations

See “Creating tables” for more information on how constraints affect optimization. For more on join indexes and foreign keys, see “Using join indexes”.

Adaptive Server IQ checks during load operations that certain constraints are obeyed:

Adaptive Server IQ ensures that data being loaded is the appropriate data type and length.

If you have a join index that relies on a foreign key-primary key relationship, when synchronizing the join index Adaptive Server IQ checks that data in the underlying tables maintains the expected one-to- many relationship between the joined columns.

How database contents get changed

Information in database tables is changed by submitting SQL statements from client applications. Only a few SQL statements actually modify the information in a database.

An existing row of a table may be deleted, using the DELETE statement.

A new row may be inserted into a table, using the INSERT statement.

Data integrity tools

To assist in maintaining data integrity, you can use data constraints, and constraints that specify the referential structure of the database.

Constraints

You can use several types of constraints on the data in individual columns or

 

tables. For example:

 

• A NOT NULL constraint prevents a column from containing a null entry.

 

Adaptive Server IQ enforces this constraint.

 

• Columns can have unenforced CHECK conditions assigned to them, to

 

specify that a particular condition should be met by every item in the

 

column. You could specify, for example, that salary column entries should

 

be within a specified range.

 

• Unenforced CHECK conditions can be made on the relative values in

 

different columns, to specify, for example, in a library database that a

 

date_returned entry is later than a date_borrowed entry.

275

Page 295
Image 295
Sybase 12.4.2 manual How database contents get changed, Data integrity tools