{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

relcalc

# relcalc - CSE 412/598 DATABASE MANAGEMENT COURSE NOTES 8...

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

CSE 412/598 DATABASE MANAGEMENT COURSE NOTES 8. RELATIONAL CALCULUS Department of Computer Science & Engineering Arizona State University

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

View Full Document
CSE 412/598 Relational Calculus 2 RELATIONAL CALCULUS Relational algebra is a procedural language, giving the operations to retrieve the data from the database. Relational calculus is a declarative (nonprocedural) query language, indicating the properties of the data to retrieve from the database. Tuple Relational Calculus (TRC) - variables represent tuples Domain Relational Calculus (DRC) - variables represent domains
CSE 412/598 Relational Calculus 3 TUPLE RELATIONAL CALCULUS (TRC) {T | cond(T)} "The set of all tuples T that satisfy the condition". 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 )} where T i - tuple variables a i - attributes T i .a j - indicates attributes to be projected cond - is a formula constructed out of atoms, specifying selection (and possibly, join conditions)

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

View Full Document
CSE 412/598 Relational Calculus 4 ATOMIC FORMULA ATOM r(T) where T is a tuple variable and r is a relation T i .a θ T j .b where θ {<, , =, , >, } T i .a θ c where c is a constant
CSE 412/598 Relational Calculus 5 ATOMIC FORMULA 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 the atom. 2. Let F, F 1 and F 2 be formulas, 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 is a formula T RUE when F 1 or F 2 are TRUE . (exists T) F T RUE if there exists at least one value for T such that F is TRUE for T. (forall T) F T RUE when F is TRUE for all values for T.

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

View Full Document
CSE 412/598 Relational Calculus 6 VALID TRC EXPRESSION free variable is not explicitly quantified global variable bound variable is declared through quantification and its scope is the quantified formula local variable A valid TRC expression { 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. Free vs. Bound Variables
CSE 412/598 Relational Calculus 7 TRC Fundamental Relational Algebra Operators r s: {T | r(T) or s(T)} e.g. {T | cse_majors(T) or eee_majors(T)} r - s: {T | r(T) and not(s(T))} e.g. {T | cse_majors(T) and not(eee_majors(T))} σ P (r): {T | r(T) and P} e.g. {T | cse_majors(T) and T.class='SR'}

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

View Full Document
CSE 412/598 Relational Calculus 8 TRC Fundamental Relational Algebra Operators π A (r): {T.a 1 , T.a 2 , . .., T.a n | r(T)} where A={a 1 , a 2 , . .., a n } and A attr(r) e.g. {T.id, T.name | cse_majors(T)}
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 26

relcalc - CSE 412/598 DATABASE MANAGEMENT COURSE NOTES 8...

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

View Full Document
Ask a homework question - tutors are online