PowerPoint PresentationChapter 3 OutlineThe Relational Data Model and Relational Database ConstraintsRelational Model ConceptsRelational Model Concepts (cont’d.)Domains, Attributes, Tuples, and RelationsDomains, Attributes, Tuples, and Relations (cont’d.)Slide 8Slide 9Slide 10Characteristics of RelationsCharacteristics of Relations (cont’d.)Slide 13Slide 14Slide 15Relational Model NotationSlide 17Slide 18Relational Model ConstraintsRelational Model Constraints (cont’d.)Domain ConstraintsKey Constraints and Constraints on NULL ValuesKey Constraints and Constraints on NULL Values (cont’d.)Slide 24Slide 25Relational Databases and Relational Database SchemasRelational Databases and Relational Database Schemas (cont’d.)Integrity, Referential Integrity, and Foreign KeysIntegrity, Referential Integrity, and Foreign Keys (cont’d.)Slide 30Other Types of ConstraintsOther Types of Constraints (cont’d.)Update Operations, Transactions, and Dealing with Constraint ViolationsSlide 34Slide 35Slide 36The Insert OperationThe Delete OperationThe Update OperationThe Transaction ConceptSummaryCopyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-WesleyChapter 3The Relational Data Model and Relational Database ConstraintsCopyright © 2011 Ramez Elmasri and Shamkant NavatheChapter 3 OutlineThe Relational Data Model andRelational Database ConstraintsRelational Model Constraintsand Relational Database SchemasUpdate Operations, Transactions,and Dealing with Constraint ViolationsCopyright © 2011 Ramez Elmasri and Shamkant NavatheThe Relational Data Model andRelational Database ConstraintsRelational modelFirst commercial implementations available in early 1980sHas been implemented in a large number of commercial systemHierarchical and network modelsPreceded the relational modelCopyright © 2011 Ramez Elmasri and Shamkant NavatheRelational Model ConceptsRepresents data as a collection of relationsTable of valuesRow •Represents a collection of related data values•Fact that typically corresponds to a real-world entity or relationship•TupleTable name and column names •Interpret the meaning of the values in each row attributeCopyright © 2011 Ramez Elmasri and Shamkant NavatheRelational Model Concepts (cont’d.)Copyright © 2011 Ramez Elmasri and Shamkant NavatheDomains, Attributes, Tuples, and RelationsDomain D Set of atomic valuesAtomicEach value indivisibleSpecifying a domain Data type specified for each domainCopyright © 2011 Ramez Elmasri and Shamkant NavatheDomains, Attributes, Tuples, and Relations (cont’d.)Relation schema RDenoted by R(A1, A2, ...,An)Made up of a relation name R and a list of attributes, A1, A2, ..., AnAttribute Ai Name of a role played by some domain D in the relation schema RDegree (or arity) of a relation Number of attributes n of its relation schemaCopyright © 2011 Ramez Elmasri and Shamkant NavatheDomains, Attributes, Tuples, and Relations (cont’d.)Relation (or relation state) Set of n-tuples r = {t1, t2, ..., tm}Each n-tuple t •Ordered list of n values t =<v1, v2, ..., vn>•Each value vi, 1 ≤ i ≤ n, is an element of dom(Ai) or is a special NULL valueCopyright © 2011 Ramez Elmasri and Shamkant NavatheDomains, Attributes, Tuples, and Relations (cont’d.)Relation (or relation state) r(R) Mathematical relation of degree n on the domains dom(A1), dom(A2), ..., dom(An) Subset of the Cartesian product of the domains that define R:•r(R) (dom⊆ (A1) × dom(A2) × ... × dom(An))Copyright © 2011 Ramez Elmasri and Shamkant NavatheDomains, Attributes, Tuples, and Relations (cont’d.)CardinalityTotal number of values in domainCurrent relation stateRelation state at a given timeReflects only the valid tuples that represent a particular state of the real worldAttribute namesIndicate different roles, or interpretations, for the domainCopyright © 2011 Ramez Elmasri and Shamkant NavatheCharacteristics of RelationsOrdering of tuples in a relationRelation defined as a set of tuplesElements have no order among themOrdering of values within a tuple and an alternative definition of a relationOrder of attributes and values is not that important As long as correspondence between attributes and values maintainedCopyright © 2011 Ramez Elmasri and Shamkant NavatheCharacteristics of Relations (cont’d.)Alternative definition of a relation Tuple considered as a set of (<attribute>, <value>) pairsEach pair gives the value of the mapping from an attribute Ai to a value vi from dom(Ai)Use the first definition of relationAttributes and the values within tuples are orderedSimpler notationCopyright © 2011 Ramez Elmasri and Shamkant NavatheCharacteristics of Relations (cont’d.)Copyright © 2011 Ramez Elmasri and Shamkant NavatheCharacteristics of Relations (cont’d.)Values and NULLs in tuplesEach value in a tuple is atomicFlat relational model•Composite and multivalued attributes not allowed •First normal form assumptionMultivalued attributes •Must be represented by separate relationsComposite attributes •Represented only by simple component attributes in basic relational modelCopyright © 2011 Ramez Elmasri and Shamkant NavatheCharacteristics of Relations (cont’d.)NULL valuesRepresent the values of attributes that may be unknown or may not apply to a tupleMeanings for NULL values•Value unknown•Value exists but is not available•Attribute does not apply to this tuple (also known as value undefined)Copyright © 2011 Ramez Elmasri and Shamkant NavatheRelational Model NotationRelation schema R of degree n Denoted by R(A1, A2, ..., An)Uppercase letters Q, R, S Denote relation namesLowercase letters q, r, s Denote relation statesLetters t, u, v Denote tuplesCopyright © 2011 Ramez Elmasri and Shamkant NavatheRelational Model NotationName of a relation schema: STUDENTIndicates the current set of tuples in that relationNotation: STUDENT(Name, Ssn, ...) Refers only to relation schemaAttribute A can be qualified with the relation name R to which it belongs Using the dot notation R.ACopyright © 2011 Ramez Elmasri and Shamkant NavatheRelational Model Notationn-tuple t in a relation r(R) Denoted by t = <v1, v2, ..., vn>vi is the value corresponding to attribute AiComponent values of tuples:t[Ai] and t.Ai refer to
View Full Document