DOC PREVIEW
SJSU CMPE 226 - CmpE226-DB-L06n

This preview shows page 1-2-17-18-19-36-37 out of 37 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 37 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Database DesignPowerPoint PresentationSlide 3View and Logical LevelsConstraint DatabasesTwo Most Common Types of ConstraintsConstraints (1)Constraints (2)Constraints (3)Constraints (4)Boolean Atomic Constraints (1)Boolean Atomic Constraints (2)Boolean Atomic Constraints (3)Constraint Formulas (1)Constraint Formulas (2)Interpretation of free Boolean algebraConstants in constraints are also interpretedThe Constraint Data Model (1)The Constraint Data Model (2)The Constraint Data Model (3)The Constraint Data Model (4)The Constraint Data Model (5)The Constraint Data Model (6)The Constraint Data Model (7)The Constraint Data Model (8)The Constraint Data Model (9)Data Abstraction (1)Data Abstraction: View LevelData Abstraction: Logical LevelData Abstraction: Constraint LevelData Abstraction: Physical LevelDiscussion QuestionsSlide 33SolutionSlide 35Slide 36Questions for the Next Lecture2003SJSU -- CmpE L6-S1 Constraint DBDatabase Design Dr. M.E. Fayad, ProfessorComputer Engineering Department, Room #283I College of EngineeringSan José State UniversityOne Washington SquareSan José, CA 95192-0180 http://www.engr.sjsu.edu/~fayad2003SJSU – CmpE --- M.E. Fayad L6-S2 Constraint DB2Lesson 06:Constraint Databases2003SJSU – CmpE --- M.E. Fayad L6-S3 Constraint DB Lesson ObjectivesObjectives3 Understand Constraint Databases Learn How to Deal with Constraints  Arithmetic Atomic Constraints Boolean Atomic Constraints Constraint Formulas Interpretations of Free Boolean Constraints Understand the Constraint Data Model Explore Data Abstraction2003SJSU – CmpE --- M.E. Fayad L6-S4 Constraint DBAre The highest level of data abstractionAre not suitable for computer to represent data. Why?Because the allow an infinite number of tuples or points.In this lecture we discuss constraint data model that is used to represent the logical level of data in a concise way.4View and Logical Levels2003SJSU – CmpE --- M.E. Fayad L6-S5 Constraint DBNext level of data abstraction: Constraint level – finitely represents by constraints the logical level5Constraint Databases2003SJSU – CmpE --- M.E. Fayad L6-S6 Constraint DBConstraints apply to two or more variables.Each variable takes its value from a domainCommon domains are:+ The set of nonnegative numbers (or natural numbers) N+ The set of integer numbers Z+ The set of rational number Q+ The set of real numbers ROther domains – Set of English words in the dictionary W6Two Most Common Types of Constraints2003SJSU – CmpE --- M.E. Fayad L6-S7 Constraint DBAssume u and v are variables or constantsB and ci are constantsLet ± denote + or - Let p be a polynomial function over variables X1, …., XnAny valid expression with constants, variables, addition, and multiplication symbolsWe define the most basic type of constraints, called the atomic constraints over any of the domains N, Z, Q, R as following:7Constraints (1)2003SJSU – CmpE --- M.E. Fayad L6-S8 Constraint DBArithmetic Atomic Constraints Equality: u = v Inequality: u ≠ v Lower bound: u ≥ b Upper bound: – u ≥ b Order: u ≥ v Gap-order: u – v ≥ b where b ≥ 0 Difference: u – v ≥ b8Constraints (2)2003SJSU – CmpE --- M.E. Fayad L6-S9 Constraint DBHalf-Addition: ± u ± v ≥ b where b ≥ 0Addition: ± u ± v ≥ bLinear: c1x1 + ……+ cnxn ≥ bPolynomial: p( x1,……..,xn ) ≥ b Note: Instead of ≥ we can also use >b is a bound which is restricted to be nonnegative in the case of gap-order and half addition constraints.ci is a coefficient in the linear constraint.9Constraints (3)2003SJSU – CmpE --- M.E. Fayad L6-S10 Constraint DBIf a constraint C is any of these types of constraints and the domain of the variables is Z and Q we talk of integer C constraints or rational C constraints, respectively.We consider each = constraint as the conjunction of two ≥ constraints.For example: linear equation 5x+7y = 8 can be expressed as the conjunction of the linear inequality constraints:5x +7y ≥ 8 and 5x +7y ≤ 8 This is why we do not consider linear equality as atomic constraints. Nevertheless, we will write constraints with = signs.10Constraints (4)2003SJSU – CmpE --- M.E. Fayad L6-S11 Constraint DBBoolean Algebra < D, Λ, V, ‘, 0, 1 > D – domain, 0 – zero element,1 – one element. such that the following axioms hold:11Boolean Atomic Constraints (1)2003SJSU – CmpE --- M.E. Fayad L6-S12 Constraint DBCommutative: x V y = y V x x Λ y = y Λ xDistributive: x V ( y Λ z ) = ( x V y ) Λ ( x V z ) x Λ ( y V z ) = ( x Λ y ) V ( x Λ z )Inverse: x V x’ = 1 x Λ x’ = 0Zero and one element properties: x V 0 = x x Λ 1 = x 0 ≠ 112Boolean Atomic Constraints (2)2003SJSU – CmpE --- M.E. Fayad L6-S13 Constraint DBBoolean equality constraints: T =B 0Boolean inequality constraints: T ≠B 0 where T is a Boolean term built from domain elements and operations of the boolean algebra.Example:( x’ Λ z ) V ( y Λ z ) V ( x Λ y’ Λ z’ ) =B 013Boolean Atomic Constraints (3)2003SJSU – CmpE --- M.E. Fayad L6-S14 Constraint DBeach atomic constraint if F and G are formulas, then (F and G) is a formula and (F or G) is a formula.if F is a formula, then (not F) is a formula.14Constraint Formulas (1)2003SJSU – CmpE --- M.E. Fayad L6-S15 Constraint DBLet F(x1,…,xn) be a formula with n rows, t = (c1,…,cn) a tuple with n constants.t satisfies F (t F) – substituting each xi by ci makes F true.15Constraint Formulas (2)2003SJSU – CmpE --- M.E. Fayad L6-S16 Constraint DBSymbols are interpreted to be concrete operators or values. Example: D – all subsets of 1 Λ – intersection V – union ‘ – complement 0 – emptyset 1 – set of names of all animals {cat, dog, parrot,…} Question: What would be the meaning of the example Boolean constraint under this interpretation ?16Interpretation of free Boolean algebra2003SJSU – CmpE --- M.E. Fayad L6-S17 Constraint DBExample: Suppose we have the constraint b Λ m = 0 and we interpret b as {canary, parrot, falcon} m as {cat, dog}Question:


View Full Document

SJSU CMPE 226 - CmpE226-DB-L06n

Documents in this Course
SQL-99

SQL-99

71 pages

XML

XML

52 pages

XML

XML

14 pages

Chapter 9

Chapter 9

45 pages

Load more
Download CmpE226-DB-L06n
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view CmpE226-DB-L06n and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view CmpE226-DB-L06n 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?