Prev | Current Page 426 | Next

Carl Reynolds and Paul Tymann

"Schaum's Outline of Principles of Computer Science"

'
ROLLBACK TRAN
RETURN
END
IF @Dorm = 'Appleby' and (@Room > 9999 or @Room < 1000)
BEGIN
PRINT 'Appleby dorm has 4 digit room numbers.'
ROLLBACK TRAN
RETURN
END
IF @Dorm = 'Arpers' and (@Room > 99 or @Room < 10)
BEGIN
PRINT 'Arpers dorm has 2 digit room numbers.'
ROLLBACK TRAN
RETURN
END
Once again, you see some phrases that look like standard SQL, and you also see many constructs that are
not SQL-like at all. One must learn another programming language to take advantage of stored procedures
and triggers. Nevertheless, most production databases make use of triggers to enforce data and business rules
automatically and efficiently.
DATA INTEGRITY
Database systems provide tools for helping to maintain the integrity of the data. An important set of base
rules for insuring good and consistent data in the database is called referential integrity constraints.
The built-in rules for enforcing referential integrity are these:
1 Inserting a new row into a parent table is always allowed.
2 Inserting a new row into a child table is allowed only if the foreign key value exists in the parent table.
3 Deleting a row from a parent table is permitted only if there are no child rows.
4 Deleting a row from a child table is always allowed.


Pages:
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438
www.books61.hobbitstory.com tanie noclegi międzyzdroje pokoje windsurfing Władysławowo noclegi e-lady