Noprimarykeyattributemaybenullall

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: te primary key (uniquely identifies the order line)…individually they are foreign keys (implement M:N relationship between order and product) 6 Integrity Constraints Domain Constraints Entity Integrity Allowable values for an attribute. No primary key attribute may be null. All primary key fields MUST have data Action Assertions Business rules. Recall from Ch. 4 7 Domain definitions enforce domain integrity constraints 8 Integrity Constraints Referential Integrity–rule states that any foreign key value (on the relation of the many side) MUST match a primary key value in the relation of the one side. (Or the foreign key can be null) For example: Delete Rules Restrict ­ don’t allow delete of “parent” side if related rows exist in “dependent” side Cascade ­ automatically delete “dependent” side rows that correspond with the “parent” side row to be deleted Set­to­Null ­ set the foreign key in the dependent side to null if deleting from the parent side not allowed for weak entities 9 Referential integrity constraints (Pine Valley Furniture) Referential integrity constraints are drawn via arrows from dependent to parent table 10 SQL table definitions Referential integrity constraints are implemented with foreign key to primary key references 11 Transforming EER Diagrams into Relations Mapping Regular Entities to Relations 1. 2. 3. Simple attributes: E­R attributes map directly onto the relation Composite attributes: Use only their simple, component attributes Multivalued Attribute: Becomes a separate relation with a foreign key taken from the superior entity 12 Mapping a regular entity (a) CUSTOMER entity type with simple attributes (b) CUSTOMER relation 13 Mapping a composite attribute (a) CUSTOMER entity type with composite attribute (b) CUSTOMER relation with address detail 14 Mapping an entity with a multivalued attribute (a) Multivalued attribute becomes a separate relation with foreign key (b) One–to–many relationship between original entity and new relation 15 Mapping Weak Entities Becomes a separate relation with a foreign key taken from the superior entity Primary key composed of: Partial identifier of weak entity Primary key of identifying relation (strong entity) 16 Example of mapping a weak entity a) Weak entity DEPENDENT 17 Example of mapping a weak entity (cont.) b) Relations resulting from weak entity NOTE: the domain constraint for the foreign key should NOT allow null value if DEPENDENT is a weak entity Foreign key Composite primary key 18 Mappi...
View Full Document

This note was uploaded on 07/23/2012 for the course COMP 1730 taught by Professor Tony during the Spring '06 term at British Columbia Institute of Technology.

Ask a homework question - tutors are online