{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

6-Calculus

# 6-Calculus - CS273 Data and Knowledge Bases Xifeng Y Xif...

This preview shows pages 1–8. Sign up to view the full content.

CS273 - Data and Knowledge Bases Xifeng Yan Computer Science niversity of California at Santa Barbara University of California at Santa Barbara

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Department of Computer Science RELATIONAL CALCULUS Relational algebra is a procedural language, giving the operations to retrieve the data from the database. Relational calculus isa declarative (nonprocedural) query language, indicating the properties of the data to retrieve from the database. Tuple Relational Calculus (TRC) - variables represent tuples omain elational alculus RC) ariables present omains Domain Relational Calculus (DRC) - variables represent domains SQL is declarative, based on tuple relational calculus! CS273: Data and Knowledge Bases | University of California at Santa Barbara 2 slides by courtesy of Y. Chen with modifications
Department of Computer Science Outline Tuple Relational Calculus (TRC) Expressions Expressing Relational Algebra Operators Safety Domain Relational Calculus (DRC) CS273: Data and Knowledge Bases | University of California at Santa Barbara 3

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Department of Computer Science TUPLE RELATIONAL CALCULUS (TRC) {T | cond(T)} "The set of all tuples T that satisfy the condition cond". Formal specification {T 1 .a 1 , T 2 .a 2 , . .., T n .a n | cond(T 1 , . .., T n , T n+1 , . .., T n+m )} here where T i - tuple variables a i - attributes dicates attributes to be projected T i .a j - indicates attributes to be projected cond - is a formula constructed out of atom s, specifying selection (and possibly, join conditions) CS273: Data and Knowledge Bases | University of California at Santa Barbara 4
Department of Computer Science ATOM ATOM r(T) where T is a tuple variable and r is a relation T i .a T j .b where  {<, , =, , >, } here c is a constant T i .a c where c is a constant CS273: Data and Knowledge Bases | University of California at Santa Barbara 5

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Department of Computer Science ATOMIC FORMULA A formula is composed of atoms using the following rules: 1. An atom is a formula. Its truth value is given by the truth value of e atom the atom. 2. Let F, F 1 and F 2 be formulas, T be a tuple variable, then the following are formulas : Formula Truth Value (F) TRUE when F is TRUE . not (F) T RUE when F is FALSE . () F 1 and F 2 T RUE when F 1 and F 2 are TRUE . F 1 or F 2 T RUE when F 1 or F 2 are TRUE . xists T) F T RUE if there exists at least one alue for T such that F is RUE or (exists T) F value for T such that F is TRUE for T. (forall T) F T RUE when F is TRUE for all values for T. CS273: Data and Knowledge Bases | University of California at Santa Barbara 6
Department of Computer Science VALID TRC EXPRESSION free variable is not explicitly global variable Free vs. Bound Variables quantified bound variable is declared through local variable quantification and its scope is the quantified formula A valid TRC expression T1 T2 … Tn | F(T1 T2 … Tn) } { T1, T2, , Tn | F(T1, T2, Tn) } has only the tuple variables appearing to the left of the vertical bar (|) free in F. Any other variable appearing in F must be bound.

This preview has intentionally blurred sections. Sign up to view the full version.

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

{[ snackBarMessage ]}

### Page1 / 35

6-Calculus - CS273 Data and Knowledge Bases Xifeng Y Xif...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online