CMPS 277 Principles of Database Systems. Lecture #4

Size: px
Start display at page:

Download "CMPS 277 Principles of Database Systems. Lecture #4"

Transcription

1 CMPS 277 Principles of Database Systems Lecture #4 1

2 First-Order Logic Question: What is First-Order Logic? Answer: Informally, First-Order Logic = Propositional Logic + ( and ), where and range over possible values occurring in relations. 2

3 Relational Calculus (First-Order Logic for Databases) First-order variables: x, y, z,, x 1,,x k, They range over values that may occur in tables. Relation symbols: R, S, T, of specified arities (names of relations) Atomic (Basic) Formulas: R(x 1,,x k ), where R is a k-ary relation symbol (alternatively, (x 1,,x k ) R; the variables need not be distinct) (x op y), where op is one of =,, <, >,, (x op c), where c is a constant and op is one of =,, <, >,,. Relational Calculus Formulas: Every atomic formula is a relational calculus formula. If ϕ and ψ are relational calculus formulas, then so are: (ϕæψ), (ϕçψ), ψ, (ϕ ψ) (propositional connectives) ( x ϕ) (existential quantification) ( x ϕ) (universal quantification). 3

4 Free and Bound Variables A sentence is a first-order formula ψ with no free variables. ( x)e(x,x) ( x)( y)( z)(e(x,z) Æ E(z,y)) ( x)( y)(x < y z (x < z Æ z < y)) On every relational database I, a sentence is either true or false. Either I ψ or I ψ If a first-order formula has at least one free variable, then it makes no sense to tell whether it is true or false on a relational database I. Instead, we need to also assign values to its free variables I, 3, 5 z (x < z Æ z < y) I, 3, 4 z (x < z Æ z < y), where I is the linear order < on the natural numbers 1, 2, 3, 4

5 Queries Definition: Let S be a relational database schema. A k-ary query on S is a function q defined on the relational database instances over S such that if I is a relational database instance over S, then q(i) is a k-ary relation (i.e., a set of k-tuples). Note: All queries that we have expressed in relational algebra and/or in SQL thus far are queries in the above formal sense. Find the salaries of department chairs (binary query) Find the students who are enrolled in every course taught by Victor Vianu (unary query) The natural join R S of R(A,B,C) and S(B,C,D) (4-ary query) 5

6 Relational Calculus as a Database Query Language Definition: A relational calculus expression is an expression of the form {(x 1,,x k ): ϕ(x 1, x k )}, where ϕ(x 1,,x k ) is a relational calculus formula with x 1,,x k as its free variables. When applied to a relational database I, this relational calculus expression returns the k-ary relation that consists of all k-tuples (a 1,,a k ) that make the formula true on I. Thus, every relational calculus expression as above defines a k-ary query. Example: The relational calculus expression {(x,y): z(e(x,z) Æ E(z,y)} returns the set P of all pairs of nodes (a,b) that are connected via a path of length 2. 6

7 Relational Calculus as a Database Query Language Example: FACULTY(name, dpt, salary) Find the names of the highest paid faculty in CS {x: ϕ(x)}, where ϕ(x) is the formula: y,z (FACULTY(x,y,z) Æ y = CS Æ ( u,v,w(faculty(u,v,w) Æ v = CS z w))) Exercise: Express this query in relational algebra and in SQL. Abbreviation: x 1,,x k stands for x 1,, x k x 1,,x k stands for x 1,, x k 7

8 Natural Join in Relational Calculus Example: Let R(A,B,C) and S(B,C,D) be two ternary relation schemas. Recall that, in relational algebra, the natural join R S is given by π R.A,R.B,R.C,S.D (σ R.B = S.B Æ R.C = S.C (R S)). Give a relational calculus expression for R S {(x 1,x 2,x 3,x 4 ): R(x 1,x 2,x 3 ) Æ S(x 2,x 3,x 4 )} Note: The natural join is expressible by a quantifier-free formula of relational calculus. 8

9 Quotient in Relational Calculus Recall that the quotient (or division) R S of two relations R and S is the relation of arity r s consisting of all tuples (a 1,,a r-s ) such that for every tuple (b 1,,b s ) in S, we have that (a 1,,a r-s, b 1,,b s ) is in R. Assume that R has arity five and S has arity 2. Express R S in relational calculus. {(x 1,x 2,x 3 ): ( x 4 )( x 5 ) (S(x 4,x 5 ) R(x 1,x 2,x 3,x 4,x 5 ))} Much simpler than the relational algebra expression for R S 9

10 The need for more formal semantics for Relational Calculus The semantics of the relational calculus expressions considered thus far have been unambiguous (and consistent with our intuition). However, consider the following relational calculus expressions: {(x 1,,x k ): R(x 1,,x k )} {(x,y): z(chair(x,z) Æ y z)}, where CHAIR(dpt,name) {x: y,z ENROLLS(x,y,z)}, with ENROLLS(s-name,course,term) Question: What is the semantics of each of these expressions? 10

11 The need for more formal semantics for Relational Calculus Fact: To evaluate {(x 1,,x k ): R(x 1,,x k )} we need to know what the possible values for the variables x 1,, x k are. If the variables x 1,,x k range over a domain D, then {(x 1,,x k ): R(x 1,,x k )} = D k R. Note: Intuitively, the relational calculus expression {(x 1,,x k ): R(x 1,,x k )} is not domain independent. In contrast, the relational calculus expression {(x 1,,x k ): S(x 1,..,x k ) Æ R(x 1,,x k )} is domain independent. 11

12 Active Domain Definition: The active domain adom(ϕ) of a relational calculus formula ϕ is the set of all constants that occur in ϕ. If ϕ is R(x,y), then adom(ϕ) = If ϕ is y(r(x,y) Æ y > 3), then adom(ϕ) = {3}. If ϕ is y(p(x,2,y) R(x,y)), then adom(ϕ) = {2}. The active domain adom(i) of a relational database instance I is the set of all values that occur in the relations of I. 12

13 Active Domain and Relative Interpretations Definition: Let ϕ(x 1,,x k ) be a relational calculus formula and let I be a relational database instance. If is D a domain such adom(ϕ) adom(i) D, then ϕ D (I) is the result of evaluating ϕ(x 1,,x k ) over D and I, that is, all variables and quantifiers are assumed to range over D, and the relation symbols in ϕ are interpreted by the relations in I. ϕ adom (I) is ϕ D (I), where D = adom(ϕ) adom(i). Note: adom(ϕ) adom(i) is the smallest domain on which it makes sense to evaluate ϕ. 13

14 Active Domain and Relative Interpretation Example: Let ϕ be R(x,y) and I = {(1,2)}. ϕ adom (I) = {(2,1), (1,1), (2,2)} If D = {1,2,3}, then ϕ D (I)= {(2,1),(1,1),(2,2),(3,3),(1,3),(3,1),(2,3),(3,2)} Note: This example shows that, in general, ϕ adom (I) ϕ D (I) 14

15 Domain Independence Definition: A relational calculus formula ϕ is domain independent if for every relational instance I and every domain D such that adom(ϕ) adom(i) D, we have that ϕ D (I) = ϕ adom (I). Examples: R(x 1,,x k ) is not domain independent. yr(x,y) is domain independent. (Why?) yr(x,y) is not domain independent. (Why?) P(x) Æ y(r(x,y) y> 5) is domain independent. (Why?) 15

16 Domain Independence Examples: The following relational calculus expressions are not domain independent {x: ( y)( z) R(x,y,z)} {(x,y): z(chair(x,z) Æ y z)}, where CHAIR(dpt,name) {x: y,z ENROLLS(x,y,z)}, where ENROLLS(s-name,course,term) 16

17 Equivalence of Relational Algebra and Relational Calculus Theorem: The following are equivalent for a k-ary query q: 1. There is a relational algebra expression E such that q(i) = E(I), for every database instance I (in other words, q is expressible in relational algebra). 2. There is a domain independent relational calculus formula ϕ such that q(i) = ϕ adom (I), for every database instance I (in other words, q is expressible in domain independent relational calculus). 3. There is a relational calculus formula ψ such that q(i) = ψ adom (I), for every database instance I (in other words, q is expressible in relational calculus under the active domain interpretation). 17

18 From Relational Algebra to Relational Calculus Theorem: For every relational expression E, there is an equivalent relational calculus expression {(x 1,,x k ): ϕ(x 1, x k )}. Proof: By induction on the construction of rel. algebra expressions. If E is a relation R of arity k, then we take {(x 1,,x k ): E(x 1,,x k )}. Assume E 1 and E 2 are expressible by {(x 1,,x k ): ϕ 1 (x 1,,x k )} and {(x 1,,x k ): ϕ 2 (x 1,,x k )}. Then E 1 E 2 is expressible by {(x 1,,x k ): ϕ 1 (x 1,,x k ) Ç ϕ 2 (x 1,,x k )}. E 1 E 2 is expressible by {(x 1,,x k ): ϕ 1 (x 1,,x k ) Æ ϕ 2 (x 1,,x k )}. E 1 E 2 is expressible by {(x 1,,x k,y 1,,y m ): ϕ 1 (x 1,,x k ) Æ ϕ 2 (y 1,,y m )} 18

19 From Relational Algebra to Relational Calculus Theorem: For every relational expression E, there is an equivalent relational calculus expression {(x 1,,x k ): ϕ(x 1, x k )}. Proof: (continued) Assume that E is expressible by {(x 1,,x k ): ϕ(x 1,,x k )}. Then π 1,3 (E) is expressible by {(x 1,x 3 ): ( x 2 )( x 4 ) ( x k ) ϕ(x 1,,x k ) } σ Θ (E) is expressible by {(x 1,,x k ): Θ* Æ ϕ(x 1,,x k )}, where Θ* is the rewriting of Θ as a formula of relational calculus. Corollary: Relational Calculus is relationally complete. 19

20 From Relational Algebra to Relational Calculus Example: R(A,B), S(C,D) Translate π 1,4 (σ R.B=S.C (R S)) to relational calculus 1. R translates to R(x,y) 2. S translates to S(z,w) 3. R S translates to R(x,y) Æ S(z,w) 4. σ R.B=S.C (R S) translates to (y=z) Æ R(x,y) Æ S(z,w) 5. π 1,4 (σ R.B=S.C (R S)) translates to y z ((y=z) Æ R(x,y) Æ S(z,w)) or, simply, to y (R(x,y) Æ S(y,w))

21 Equivalence of Relational Algebra and Relational Calculus Proof (Sketch): We also need to show that the resulting formula is domain independent. Show by induction that this translation of relational algebra to relational calculus is actually a translation of relational algebra to domain independent relational calculus This implication is obvious Show first that for every relational database schema S, there is a relational algebra expression E such that for every database instance I, we have that adom(i) = E(I). Use induction on the construction of relational calculus formulas and the above fact to obtain a translation of relational calculus under the active domain interpretation to relational algebra. 21

22 Equivalence of Relational Algebra and Relational Calculus In this translation, the most interesting part is the simulation of the universal quantifier in relational algebra. It uses the logical equivalence yψ y ψ As an illustration, consider yr(x,y). yr(x,y) y R(x,y) adom(i) = π 1 (R) π 2 (R) Rel.Calc. formula ϕ Relational Algebra Expression for ϕ adom R(x,y) (π 1 (R) π 2 (R)) (π 1 (R) π 2 (R)) R y R(x,y) π 1 ((π 1 (R) π 2 (R)) (π 1 (R) π 2 (R)) - R) y R(x,y) (π 1 (R) π 2 (R)) (π 1 ((π 1 (R) π 2 (R)) (π 1 (R) π 2 (R)) - R)) 22

23 Equivalence of Relational Algebra and Relational Calculus Remarks: The Equivalence Theorem is effective. Specifically, the proof of this theorem yields two algorithms: an algorithm for translating from relational algebra to domain independent relational calculus, and an algorithm from translating from domain independent relational calculus to relational algebra. Each of these two algorithms runs in linear time. 23

24 Domain Independent Relational Calculus Note: A desirable feature of a logical formalism is that there is an (efficient) algorithm for determining whether or not an expression is a formula of that formalism. Both relational algebra and relational calculus have this property. Question: Does domain independent relational calculus have this property? In other words, is there an algorithm such that, given a relational calculus formula ϕ, the algorithm tells whether or not ϕ is domain independent? 24

25 Domain Independent Relational Calculus Bad News Theorem (Di Paola 1969): Determining domain independence is an undecidable problem, i.e., there is no algorithm such that, given a relational calculus formula ϕ, the algorithm tells whether or not ϕ is domain independent. Some Good News: Theorem: Domain independent relational calculus has an effective syntax, i.e., there is a class F of relational calculus formulas such that: There is an (efficient) algorithm for testing membership in F. Every formula in F is domain independent. Every domain independent relational calculus formula is logically equivalent to a formula in F. 25

26 Domain Independent Relational Calculus For much more on domain independence: Read Sections 5.3 and 5.4 of Foundations of Databases. Read the papers The recursive unsolvability of the decision problem for the class of definite formulas by Robert A. Di Paola, JACM, Vol. 16, 1969, pages (available at the class webpages) Safety and translation of relational calculus by Allen van Gelder and Rodney Topor, ACM Transactions on Database Systems, Vol. 16, 1991, pages (available at the class webpages). 26

27 Relational Calculus and SQL Relational calculus has influenced the design of SQL. In particular, existential and universal quantification are used in two different forms in SQL. Both these forms occur in the allowable conditions in the WHERE clause of the SELECT FROM WHERE construct. In addition, sets/multisets are allowed as operands in the WHERE clause (this is what makes existential and universal quantification meaningful). 27

28 Sets as Operands in SQL Sets are allowed as operands in the WHERE clause. Sets are defined by listing their elements (boring feature), or as the result of a SELECT FROM WHERE construct nested inside the WHERE clause of an outer SELECT FROM.. WHERE (interesting feature) This is what makes SQL a structured language, i.e., we have queries inside queries up to any finite depth of nesting. When sets are used as operands in a comparison clause: We must use one of the keywords IN, NOT IN, SOME, ALL. SOME and ALL must be preceded by one of the of comparison operators =,,,, >, <. The use of SOME and ALL is the first form of existential and universal quantification in SQL. 28

29 Sets as Operands in SQL Example: FACULTY(name,dpt,salary) Find the names of faculty who are in a department in which no member earns more than $175,000. SELECT name FROM FACULTY WHERE dpt NOT IN (SELECT dpt FROM FACULTY WHERE salary > 175,000) Exercise: Express this query without using an SQL subquery. 29

30 SOME and ALL in SQL Syntax: In the WHERE clause, we can have have subclauses of the form <attribute name> op SOME T <attribute name> op ALL T, where op is one of the comparison operators =,,,, >, < T is the result of a nested SELECT FROM WHERE clause. Semantics: <attribute name> op SOME T means: ( x)(x T Æ <attribute name> op x) <attribute name> op ALL S means: ( x)(x T <attribute name> op x). 30

31 SOME and ALL in SQL Note: <attribute name> = SOME T is the same as IN <attribute name> ALL S is the same as NOT IN Note: Earlier versions of SQL used ANY in place of SOME. The use of ANY can be quite confusing and can lead to errors. Even if the system supports ANY, it is better to avoid using it. 31

32 SOME and ALL in SQL Example: FACULTY(name,dpt,salary) Find the highest paid faculty in CS SELECT name FROM FACULTY WHERE dpt = CS AND salary ALL (SELECT salary FROM FACULTY WHERE dpt = CS ). Question: What is the result of the following SQL query? SELECT name FROM FACULTY WHERE dpt = CS AND salary > ALL (SELECT salary FROM FACULTY WHERE dpt = CS ). 32

33 SOME and ALL in SQL Question: What are the results of the following two SQL queries? SELECT name FROM FACULTY WHERE dpt = CS AND salary > SOME (SELECT salary FROM FACULTY WHERE dpt = CS ). SELECT name FROM FACULTY WHERE dpt = CS AND salary SOME (SELECT salary FROM FACULTY WHERE dpt = CS ). Answer: The first returns all CS faculty who are not the lowest paid ones. The second returns all CS faculty. 33

34 EXISTS and NOT EXISTS in SQL Syntax: SELECT FROM WHERE EXISTS (SELECT FROM WHERE) Semantics: The subquery (SELECT FROM WHERE) is evaluated and the resulting set is tested for emptiness: If it is non-empty, then the condition in WHERE evaluates to true ; otherwise, it evaluates to false. Syntax: SELECT FROM WHERE NOT EXISTS (SELECT FROM WHERE) Semantics: The subquery (SELECT FROM WHERE) is evaluated and the resulting set is tested for emptiness: If it is empty, then the condition in WHERE evaluates to true ; otherwise, it evaluates to false. 34

35 EXISTS and NOT EXISTS in SQL Example: FACULTY(name,dpt,salary) Find the faculty in the CS dpt who are not the lowest paid ones. SELECT R.name FROM FACULTY as R WHERE dpt = CS AND EXISTS (SELECT * FROM FACULTY AS T WHERE R.dpt = CS AND R.salary > T.salary) Note: This is an example of a correlated subquery: The subquery has to be evaluated separately for each tuple in the FROM list of the outer query. The tuple is kept or removed depending on the result of the EXISTS test. 35

36 EXISTS and NOT EXISTS in SQL Example: FACULTY(name,dpt,salary) Find the highest paid faculty in CS. SELECT R.name FROM FACULTY as R WHERE dpt = CS AND NOT EXISTS (SELECT * FROM FACULTY AS T WHERE R.dpt = CS AND R.salary < T.salary) Note: SQL queries with SOME and ALL can be transformed to SQL queries with EXISTS and NOT EXISTS. SOME, ALL, EXISTS, NOT EXISTS are imported directly from relational calculus. 36

CMPS 277 Principles of Database Systems. https://courses.soe.ucsc.edu/courses/cmps277/fall11/01. Lecture #3

CMPS 277 Principles of Database Systems. https://courses.soe.ucsc.edu/courses/cmps277/fall11/01. Lecture #3 CMPS 277 Principles of Database Systems https://courses.soe.ucsc.edu/courses/cmps277/fall11/01 Lecture #3 1 Summary of Lectures #1 and #2 Codd s Relational Model based on the concept of a relation (table)

More information

Schema Mappings and Data Exchange

Schema Mappings and Data Exchange Schema Mappings and Data Exchange Lecture #2 EASSLC 2012 Southwest University August 2012 1 The Relational Data Model (E.F. Codd 1970) The Relational Data Model uses the mathematical concept of a relation

More information

Logic and Databases. Phokion G. Kolaitis. UC Santa Cruz & IBM Research - Almaden

Logic and Databases. Phokion G. Kolaitis. UC Santa Cruz & IBM Research - Almaden Logic and Databases Phokion G. Kolaitis UC Santa Cruz & IBM Research - Almaden 1 Logic and Databases are inextricably intertwined. C.J. Date -- 2007 2 Logic and Databases Extensive interaction between

More information

Foundations of Databases

Foundations of Databases Foundations of Databases Relational Query Languages with Negation Free University of Bozen Bolzano, 2009 Werner Nutt (Slides adapted from Thomas Eiter and Leonid Libkin) Foundations of Databases 1 Queries

More information

Lecture 1: Conjunctive Queries

Lecture 1: Conjunctive Queries CS 784: Foundations of Data Management Spring 2017 Instructor: Paris Koutris Lecture 1: Conjunctive Queries A database schema R is a set of relations: we will typically use the symbols R, S, T,... to denote

More information

Database Theory VU , SS Codd s Theorem. Reinhard Pichler

Database Theory VU , SS Codd s Theorem. Reinhard Pichler Database Theory Database Theory VU 181.140, SS 2011 3. Codd s Theorem Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 29 March, 2011 Pichler 29 March,

More information

Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 6 Outline. Unary Relational Operations: SELECT and

Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 6 Outline. Unary Relational Operations: SELECT and Chapter 6 The Relational Algebra and Relational Calculus Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 Outline Unary Relational Operations: SELECT and PROJECT Relational

More information

Overview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic.

Overview. CS389L: Automated Logical Reasoning. Lecture 6: First Order Logic Syntax and Semantics. Constants in First-Order Logic. Overview CS389L: Automated Logical Reasoning Lecture 6: First Order Logic Syntax and Semantics Işıl Dillig So far: Automated reasoning in propositional logic. Propositional logic is simple and easy to

More information

A Retrospective on Datalog 1.0

A Retrospective on Datalog 1.0 A Retrospective on Datalog 1.0 Phokion G. Kolaitis UC Santa Cruz and IBM Research - Almaden Datalog 2.0 Vienna, September 2012 2 / 79 A Brief History of Datalog In the beginning of time, there was E.F.

More information

Relational Databases

Relational Databases Relational Databases Jan Chomicki University at Buffalo Jan Chomicki () Relational databases 1 / 49 Plan of the course 1 Relational databases 2 Relational database design 3 Conceptual database design 4

More information

Chapter 8: The Relational Algebra and The Relational Calculus

Chapter 8: The Relational Algebra and The Relational Calculus Ramez Elmasri, Shamkant B. Navathe(2017) Fundamentals of Database Systems (7th Edition),pearson, isbn 10: 0-13-397077-9;isbn-13:978-0-13-397077-7. Chapter 8: The Relational Algebra and The Relational Calculus

More information

Chapter 6: Formal Relational Query Languages

Chapter 6: Formal Relational Query Languages Chapter 6: Formal Relational Query Languages Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 6: Formal Relational Query Languages Relational Algebra Tuple Relational

More information

Relational Calculus. Lecture 4B Kathleen Durant Northeastern University

Relational Calculus. Lecture 4B Kathleen Durant Northeastern University Relational Calculus Lecture 4B Kathleen Durant Northeastern University 1 Relational Calculus Relational Calculus is an alternative way for expressing queries Main feature: specify what you want, not how

More information

Textbook: Chapter 6! CS425 Fall 2013 Boris Glavic! Chapter 3: Formal Relational Query. Relational Algebra! Select Operation Example! Select Operation!

Textbook: Chapter 6! CS425 Fall 2013 Boris Glavic! Chapter 3: Formal Relational Query. Relational Algebra! Select Operation Example! Select Operation! Chapter 3: Formal Relational Query Languages CS425 Fall 2013 Boris Glavic Chapter 3: Formal Relational Query Languages Relational Algebra Tuple Relational Calculus Domain Relational Calculus Textbook:

More information

Lecture 5: Predicate Calculus. ffl Predicate Logic ffl The Language ffl Semantics: Structures

Lecture 5: Predicate Calculus. ffl Predicate Logic ffl The Language ffl Semantics: Structures Lecture 5: Predicate Calculus ffl Predicate Logic ffl The Language ffl Semantics: Structures 1 Why Predicate Logic? Propositional logic is not powerful enough to express statements such as ffl For every

More information

4. SQL - the Relational Database Language Standard 4.3 Data Manipulation Language (DML)

4. SQL - the Relational Database Language Standard 4.3 Data Manipulation Language (DML) Since in the result relation each group is represented by exactly one tuple, in the select clause only aggregate functions can appear, or attributes that are used for grouping, i.e., that are also used

More information

CS 377 Database Systems

CS 377 Database Systems CS 377 Database Systems Relational Algebra and Calculus Li Xiong Department of Mathematics and Computer Science Emory University 1 ER Diagram of Company Database 2 3 4 5 Relational Algebra and Relational

More information

Relational Algebra. Procedural language Six basic operators

Relational Algebra. Procedural language Six basic operators Relational algebra Relational Algebra Procedural language Six basic operators select: σ project: union: set difference: Cartesian product: x rename: ρ The operators take one or two relations as inputs

More information

Introduction to Finite Model Theory. Jan Van den Bussche Universiteit Hasselt

Introduction to Finite Model Theory. Jan Van den Bussche Universiteit Hasselt Introduction to Finite Model Theory Jan Van den Bussche Universiteit Hasselt 1 Books Finite Model Theory by Ebbinghaus & Flum 1999 Finite Model Theory and Its Applications by Grädel et al. 2007 Elements

More information

2.2.2.Relational Database concept

2.2.2.Relational Database concept Foreign key:- is a field (or collection of fields) in one table that uniquely identifies a row of another table. In simpler words, the foreign key is defined in a second table, but it refers to the primary

More information

3. Relational Data Model 3.5 The Tuple Relational Calculus

3. Relational Data Model 3.5 The Tuple Relational Calculus 3. Relational Data Model 3.5 The Tuple Relational Calculus forall quantification Syntax: t R(P(t)) semantics: for all tuples t in relation R, P(t) has to be fulfilled example query: Determine all students

More information

Towards a Logical Reconstruction of Relational Database Theory

Towards a Logical Reconstruction of Relational Database Theory Towards a Logical Reconstruction of Relational Database Theory On Conceptual Modelling, Lecture Notes in Computer Science. 1984 Raymond Reiter Summary by C. Rey November 27, 2008-1 / 63 Foreword DB: 2

More information

Query formalisms for relational model relational calculus

Query formalisms for relational model relational calculus lecture 7: Query formalisms for relational model relational calculus course: Database Systems (NDBI025) doc. RNDr. Tomáš Skopal, Ph.D. SS2011/12 Department of Software Engineering, Faculty of Mathematics

More information

Safe Stratified Datalog With Integer Order Does not Have Syntax

Safe Stratified Datalog With Integer Order Does not Have Syntax Safe Stratified Datalog With Integer Order Does not Have Syntax Alexei P. Stolboushkin Department of Mathematics UCLA Los Angeles, CA 90024-1555 aps@math.ucla.edu Michael A. Taitslin Department of Computer

More information

Chapter 6 5/2/2008. Chapter Outline. Database State for COMPANY. The Relational Algebra and Calculus

Chapter 6 5/2/2008. Chapter Outline. Database State for COMPANY. The Relational Algebra and Calculus Chapter 6 The Relational Algebra and Calculus Chapter Outline Example Database Application (COMPANY) Relational Algebra Unary Relational Operations Relational Algebra Operations From Set Theory Binary

More information

Ian Kenny. November 28, 2017

Ian Kenny. November 28, 2017 Ian Kenny November 28, 2017 Introductory Databases Relational Algebra Introduction In this lecture we will cover Relational Algebra. Relational Algebra is the foundation upon which SQL is built and is

More information

Chapter 5 Relational Algebra. Nguyen Thi Ai Thao

Chapter 5 Relational Algebra. Nguyen Thi Ai Thao Chapter 5 Nguyen Thi Ai Thao thaonguyen@cse.hcmut.edu.vn Spring- 2016 Contents 1 Unary Relational Operations 2 Operations from Set Theory 3 Binary Relational Operations 4 Additional Relational Operations

More information

Operations of Relational Algebra

Operations of Relational Algebra ITCS 3160 DATA BASE DESIGN AND IMPLEMENTATION JING YANG 2010 FALL Class 11: The Relational Algebra and Relational Calculus (2) 2 Operations of Relational Algebra 1 3 Operations of Relational Algebra (cont

More information

Informationslogistik Unit 4: The Relational Algebra

Informationslogistik Unit 4: The Relational Algebra Informationslogistik Unit 4: The Relational Algebra 26. III. 2012 Outline 1 SQL 2 Summary What happened so far? 3 The Relational Algebra Summary 4 The Relational Calculus Outline 1 SQL 2 Summary What happened

More information

Relational Algebra 1

Relational Algebra 1 Relational Algebra 1 Relational Query Languages v Query languages: Allow manipulation and retrieval of data from a database. v Relational model supports simple, powerful QLs: Strong formal foundation based

More information

QUIZ 1 REVIEW SESSION DATABASE MANAGEMENT SYSTEMS

QUIZ 1 REVIEW SESSION DATABASE MANAGEMENT SYSTEMS QUIZ 1 REVIEW SESSION DATABASE MANAGEMENT SYSTEMS SCHEMA DESIGN & RELATIONAL ALGEBRA A database schema is the skeleton structure that represents the logical view of the entire database Logical design of

More information

Function Symbols in Tuple-Generating Dependencies: Expressive Power and Computability

Function Symbols in Tuple-Generating Dependencies: Expressive Power and Computability Function Symbols in Tuple-Generating Dependencies: Expressive Power and Computability Georg Gottlob Reinhard Pichler Emanuel Sallinger University of Oxford Vienna University of Technology Vienna University

More information

1.3 Primitive Recursive Predicates and Bounded Minimalization

1.3 Primitive Recursive Predicates and Bounded Minimalization 12 1 Primitive Recursive Functions 1.3 Primitive Recursive Predicates and Bounded Minimalization 1.3.1 Case discrimination function The case discrimination function D is defined by D(x, y, z) = v x 0 v

More information

1. The Relational Model

1. The Relational Model 1. The Relational Model Stéphane Bressan January 22, 2015 This lecture is based on material by Professor Ling Tok Wang. CS 4221: Database Design The Relational Model Ling Tok Wang National University of

More information

Detecting Logical Errors in SQL Queries

Detecting Logical Errors in SQL Queries Detecting Logical Errors in SQL Queries Stefan Brass Christian Goldberg Martin-Luther-Universität Halle-Wittenberg, Institut für Informatik, Von-Seckendorff-Platz 1, D-06099 Halle (Saale), Germany (brass

More information

Structural Characterizations of Schema-Mapping Languages

Structural Characterizations of Schema-Mapping Languages Structural Characterizations of Schema-Mapping Languages Balder ten Cate University of Amsterdam and UC Santa Cruz balder.tencate@uva.nl Phokion G. Kolaitis UC Santa Cruz and IBM Almaden kolaitis@cs.ucsc.edu

More information

CMP-3440 Database Systems

CMP-3440 Database Systems CMP-3440 Database Systems Relational DB Languages Relational Algebra, Calculus, SQL Lecture 05 zain 1 Introduction Relational algebra & relational calculus are formal languages associated with the relational

More information

Composing Schema Mapping

Composing Schema Mapping Composing Schema Mapping An Overview Phokion G. Kolaitis UC Santa Cruz & IBM Research Almaden Joint work with R. Fagin, L. Popa, and W.C. Tan 1 Data Interoperability Data may reside at several different

More information

Agenda. Database Systems. Session 5 Main Theme. Relational Algebra, Relational Calculus, and SQL. Dr. Jean-Claude Franchitti

Agenda. Database Systems. Session 5 Main Theme. Relational Algebra, Relational Calculus, and SQL. Dr. Jean-Claude Franchitti Database Systems Session 5 Main Theme Relational Algebra, Relational Calculus, and SQL Dr. Jean-Claude Franchitti New York University Computer Science Department Courant Institute of Mathematical Sciences

More information

Foundations of Schema Mapping Management

Foundations of Schema Mapping Management Foundations of Schema Mapping Management Marcelo Arenas Jorge Pérez Juan Reutter Cristian Riveros PUC Chile PUC Chile University of Edinburgh Oxford University marenas@ing.puc.cl jperez@ing.puc.cl juan.reutter@ed.ac.uk

More information

Database Theory VU , SS Introduction: Relational Query Languages. Reinhard Pichler

Database Theory VU , SS Introduction: Relational Query Languages. Reinhard Pichler Database Theory Database Theory VU 181.140, SS 2011 1. Introduction: Relational Query Languages Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 8 March,

More information

Database Theory VU , SS Introduction: Relational Query Languages. Reinhard Pichler

Database Theory VU , SS Introduction: Relational Query Languages. Reinhard Pichler Database Theory Database Theory VU 181.140, SS 2018 1. Introduction: Relational Query Languages Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 6 March,

More information

SQL s Three-Valued Logic and Certain Answers

SQL s Three-Valued Logic and Certain Answers SQL s Three-Valued Logic and Certain Answers Leonid Libkin School of Informatics, University of Edinburgh Abstract SQL uses three-valued logic for evaluating queries on databases with nulls. The standard

More information

Semantic Errors in Database Queries

Semantic Errors in Database Queries Semantic Errors in Database Queries 1 Semantic Errors in Database Queries Stefan Brass TU Clausthal, Germany From April: University of Halle, Germany Semantic Errors in Database Queries 2 Classification

More information

This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS

This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS 1 THE FORMALIZATION OF MATHEMATICS by Harvey M. Friedman Ohio State University Department of Mathematics friedman@math.ohio-state.edu www.math.ohio-state.edu/~friedman/ May 21, 1997 Can mathematics be

More information

The Complexity of Data Exchange

The Complexity of Data Exchange The Complexity of Data Exchange Phokion G. Kolaitis IBM Almaden kolaitis@almaden.ibm.com Jonathan Panttaja UC Santa Cruz jpanttaj@cs.ucsc.edu Wang-Chiew Tan UC Santa Cruz wctan@cs.ucsc.edu ABSTRACT Data

More information

LTCS Report. Concept Descriptions with Set Constraints and Cardinality Constraints. Franz Baader. LTCS-Report 17-02

LTCS Report. Concept Descriptions with Set Constraints and Cardinality Constraints. Franz Baader. LTCS-Report 17-02 Technische Universität Dresden Institute for Theoretical Computer Science Chair for Automata Theory LTCS Report Concept Descriptions with Set Constraints and Cardinality Constraints Franz Baader LTCS-Report

More information

CSEN 501 CSEN501 - Databases I

CSEN 501 CSEN501 - Databases I CSEN501 - Databases I Lecture 5: Structured Query Language (SQL) Prof. Dr. Slim slim.abdennadher@guc.edu.eg German University Cairo, Faculty of Media Engineering and Technology Structured Query Language:

More information

Chapter 5. Relational Algebra and Relational Calculus

Chapter 5. Relational Algebra and Relational Calculus Chapter 5 Relational Algebra and Relational Calculus Overview The previous chapter covers the relational model, which provides a formal description of the structure of a database This chapter covers the

More information

The Inverse of a Schema Mapping

The Inverse of a Schema Mapping The Inverse of a Schema Mapping Jorge Pérez Department of Computer Science, Universidad de Chile Blanco Encalada 2120, Santiago, Chile jperez@dcc.uchile.cl Abstract The inversion of schema mappings has

More information

Institute of Southern Punjab, Multan

Institute of Southern Punjab, Multan Institute of Southern Punjab, Multan Mr. Muhammad Nouman Farooq BSC-H (Computer Science) MS (Telecomm. and Networks) Honors: Magna Cumm Laude Honors Degree Gold Medalist! Blog Url: noumanfarooqatisp.wordpress.com

More information

Chapter 2 & 3: Representations & Reasoning Systems (2.2)

Chapter 2 & 3: Representations & Reasoning Systems (2.2) Chapter 2 & 3: A Representation & Reasoning System & Using Definite Knowledge Representations & Reasoning Systems (RRS) (2.2) Simplifying Assumptions of the Initial RRS (2.3) Datalog (2.4) Semantics (2.5)

More information

Phil 320 Chapter 7: Recursive sets and relations Note: 0. Introduction Significance of and main objectives for chapter 7:

Phil 320 Chapter 7: Recursive sets and relations Note: 0. Introduction Significance of and main objectives for chapter 7: Phil 320 Chapter 7: Recursive sets and relations (Note: We cover only section 7.1.) 0. Introduction Significance of and main objectives for chapter 7: 1. Chapter 7 generalizes the notion of recursive (or

More information

Database Tuning and Physical Design: Basics of Query Execution

Database Tuning and Physical Design: Basics of Query Execution Database Tuning and Physical Design: Basics of Query Execution Spring 2018 School of Computer Science University of Waterloo Databases CS348 (University of Waterloo) Query Execution 1 / 43 The Client/Server

More information

Uncertainty in Databases. Lecture 2: Essential Database Foundations

Uncertainty in Databases. Lecture 2: Essential Database Foundations Uncertainty in Databases Lecture 2: Essential Database Foundations Table of Contents 1 2 3 4 5 6 Table of Contents Codd s Vision Codd Catches On Top Academic Recognition Selected Publication Venues 1 2

More information

Foundations of Databases

Foundations of Databases Foundations of Databases Free University of Bozen Bolzano, 2004 2005 Thomas Eiter Institut für Informationssysteme Arbeitsbereich Wissensbasierte Systeme (184/3) Technische Universität Wien http://www.kr.tuwien.ac.at/staff/eiter

More information

Chapter 6 - Part II The Relational Algebra and Calculus

Chapter 6 - Part II The Relational Algebra and Calculus Chapter 6 - Part II The Relational Algebra and Calculus Copyright 2004 Ramez Elmasri and Shamkant Navathe Division operation DIVISION Operation The division operation is applied to two relations R(Z) S(X),

More information

Chapter 6 The Relational Algebra and Relational Calculus

Chapter 6 The Relational Algebra and Relational Calculus Chapter 6 The Relational Algebra and Relational Calculus Fundamentals of Database Systems, 6/e The Relational Algebra and Relational Calculus Dr. Salha M. Alzahrani 1 Fundamentals of Databases Topics so

More information

8. Relational Calculus (Part II)

8. Relational Calculus (Part II) 8. Relational Calculus (Part II) Relational Calculus, as defined in the previous chapter, provides the theoretical foundations for the design of practical data sub-languages (DSL). In this chapter, we

More information

CS 186, Fall 2002, Lecture 8 R&G, Chapter 4. Ronald Graham Elements of Ramsey Theory

CS 186, Fall 2002, Lecture 8 R&G, Chapter 4. Ronald Graham Elements of Ramsey Theory Relational Calculus CS 186, Fall 2002, Lecture 8 R&G, Chapter 4 We will occasionally use this arrow notation unless there is danger of no confusion. Ronald Graham Elements of Ramsey heory Relational Calculus

More information

Relational Algebra and SQL

Relational Algebra and SQL Relational Algebra and SQL Relational Algebra. This algebra is an important form of query language for the relational model. The operators of the relational algebra: divided into the following classes:

More information

Introduction to Query Processing and Query Optimization Techniques. Copyright 2011 Ramez Elmasri and Shamkant Navathe

Introduction to Query Processing and Query Optimization Techniques. Copyright 2011 Ramez Elmasri and Shamkant Navathe Introduction to Query Processing and Query Optimization Techniques Outline Translating SQL Queries into Relational Algebra Algorithms for External Sorting Algorithms for SELECT and JOIN Operations Algorithms

More information

RELATION AND RELATIONAL OPERATIONS

RELATION AND RELATIONAL OPERATIONS Relation: RELATION AND RELATIONAL OPERATIONS A table with a distinct name for each column (attribute). Each attribute A i has associated with it a domain D i of possible values that may appear in that

More information

The area of query languages, and more generally providing access to stored data, is

The area of query languages, and more generally providing access to stored data, is P A R T B Basics: Relational Query Languages The area of query languages, and more generally providing access to stored data, is one of the most important topics in databases and one of the most deeply

More information

Chapter 3: Relational Model

Chapter 3: Relational Model Chapter 3: Relational Model Structure of Relational Databases Relational Algebra Tuple Relational Calculus Domain Relational Calculus Extended Relational-Algebra-Operations Modification of the Database

More information

DATABASE DESIGN II - 1DL400

DATABASE DESIGN II - 1DL400 DATABASE DESIGN II - 1DL400 Fall 2016 A second course in database systems http://www.it.uu.se/research/group/udbl/kurser/dbii_ht16 Kjell Orsborn Uppsala Database Laboratory Department of Information Technology,

More information

RELATIONAL DATA MODEL: Relational Algebra

RELATIONAL DATA MODEL: Relational Algebra RELATIONAL DATA MODEL: Relational Algebra Outline 1. Relational Algebra 2. Relational Algebra Example Queries 1. Relational Algebra A basic set of relational model operations constitute the relational

More information

DATABASE THEORY. Lecture 11: Introduction to Datalog. TU Dresden, 12th June Markus Krötzsch Knowledge-Based Systems

DATABASE THEORY. Lecture 11: Introduction to Datalog. TU Dresden, 12th June Markus Krötzsch Knowledge-Based Systems DATABASE THEORY Lecture 11: Introduction to Datalog Markus Krötzsch Knowledge-Based Systems TU Dresden, 12th June 2018 Announcement All lectures and the exercise on 19 June 2018 will be in room APB 1004

More information

SQL Subqueries. T. M. Murali. September 2, T. M. Murali September 2, 2009 CS 4604: SQL Subqueries

SQL Subqueries. T. M. Murali. September 2, T. M. Murali September 2, 2009 CS 4604: SQL Subqueries SQL Subqueries T. M. Murali September 2, 2009 Linear Notation for Relational Algebra Relational algebra expressions can become very long. Use linear notation to store results of intemediate expressions.

More information

The SQL data-definition language (DDL) allows defining :

The SQL data-definition language (DDL) allows defining : Introduction to SQL Introduction to SQL Overview of the SQL Query Language Data Definition Basic Query Structure Additional Basic Operations Set Operations Null Values Aggregate Functions Nested Subqueries

More information

Data integration lecture 2

Data integration lecture 2 PhD course on View-based query processing Data integration lecture 2 Riccardo Rosati Dipartimento di Informatica e Sistemistica Università di Roma La Sapienza {rosati}@dis.uniroma1.it Corso di Dottorato

More information

7. Relational Calculus (Part I) 7.1 Introduction

7. Relational Calculus (Part I) 7.1 Introduction 7. Relational Calculus (Part I) 7.1 Introduction We established earlier the fundamental role of relational algebra and calculus in relational databases (see 5.1). More specifically, relational calculus

More information

A Generating Plans from Proofs

A Generating Plans from Proofs A Generating Plans from Proofs Michael Benedikt, University of Oxford and Balder ten Cate, LogicBlox and UC-Santa Cruz and Efthymia Tsamoura, University of Oxford Categories and Subject Descriptors: H.2.3

More information

The Relational Algebra and Calculus. Copyright 2013 Ramez Elmasri and Shamkant B. Navathe

The Relational Algebra and Calculus. Copyright 2013 Ramez Elmasri and Shamkant B. Navathe The Relational Algebra and Calculus Copyright 2013 Ramez Elmasri and Shamkant B. Navathe Chapter Outline Relational Algebra Unary Relational Operations Relational Algebra Operations From Set Theory Binary

More information

Relational Algebra and Relational Calculus. Pearson Education Limited 1995,

Relational Algebra and Relational Calculus. Pearson Education Limited 1995, Relational Algebra and Relational Calculus 1 Objectives Meaning of the term relational completeness. How to form queries in relational algebra. How to form queries in tuple relational calculus. How to

More information

Optimization of logical query plans Eliminating redundant joins

Optimization of logical query plans Eliminating redundant joins Optimization of logical query plans Eliminating redundant joins 66 Optimization of logical query plans Query Compiler Execution Engine SQL Translation Logical query plan "Intermediate code" Logical plan

More information

CS317 File and Database Systems

CS317 File and Database Systems CS317 File and Database Systems Lecture 3 Relational Calculus and Algebra Part-2 September 10, 2017 Sam Siewert RDBMS Fundamental Theory http://dilbert.com/strips/comic/2008-05-07/ Relational Algebra and

More information

Database Systems CSE 303. Outline. Lecture 06: SQL. What is Sub-query? Sub-query in WHERE clause Subquery

Database Systems CSE 303. Outline. Lecture 06: SQL. What is Sub-query? Sub-query in WHERE clause Subquery Database Systems CSE 303 Lecture 06: SQL 2016 Subquery Outline What is a Subquery Subquery in WHERE clause >ALL, >ANY, >=ALL,

More information

Introduction to Data Management CSE 344. Lecture 14: Datalog (guest lecturer Dan Suciu)

Introduction to Data Management CSE 344. Lecture 14: Datalog (guest lecturer Dan Suciu) Introduction to Data Management CSE 344 Lecture 14: Datalog (guest lecturer Dan Suciu) CSE 344 - Winter 2017 1 Announcements WQ 4 and HW 4 due on Thursday Midterm next Monday in class This week: Today:

More information

Craig Interpolation Theorems and Database Applications

Craig Interpolation Theorems and Database Applications Craig Interpolation Theorems and Database Applications Balder ten Cate! LogicBlox & UC Santa Cruz!!!! November 7, 2014, UC Berkeley - Logic Colloquium! 1 Craig Interpolation William Craig (1957): For all

More information

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution

Foundations of AI. 9. Predicate Logic. Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution Foundations of AI 9. Predicate Logic Syntax and Semantics, Normal Forms, Herbrand Expansion, Resolution Wolfram Burgard, Andreas Karwath, Bernhard Nebel, and Martin Riedmiller 09/1 Contents Motivation

More information

COMP9311 Week 10 Lecture. DBMS Architecture. DBMS Architecture and Implementation. Database Application Performance

COMP9311 Week 10 Lecture. DBMS Architecture. DBMS Architecture and Implementation. Database Application Performance COMP9311 Week 10 Lecture DBMS Architecture DBMS Architecture and Implementation 2/51 Aims: examine techniques used in implementation of DBMSs: query processing (QP), transaction processing (TxP) use QP

More information

Laconic Schema Mappings: Computing the Core with SQL Queries

Laconic Schema Mappings: Computing the Core with SQL Queries Laconic Schema Mappings: Computing the Core with SQL Queries Balder ten Cate INRIA and ENS Cachan balder.tencate@inria.fr Laura Chiticariu IBM Almaden chiti@almaden.ibm.com Phokion Kolaitis UC Santa Cruz

More information

CSC 261/461 Database Systems Lecture 13. Fall 2017

CSC 261/461 Database Systems Lecture 13. Fall 2017 CSC 261/461 Database Systems Lecture 13 Fall 2017 Announcement Start learning HTML, CSS, JavaScript, PHP + SQL We will cover the basics next week https://www.w3schools.com/php/php_mysql_intro.asp Project

More information

Inverting Schema Mappings: Bridging the Gap between Theory and Practice

Inverting Schema Mappings: Bridging the Gap between Theory and Practice Inverting Schema Mappings: Bridging the Gap between Theory and Practice Marcelo Arenas Jorge Pérez Juan Reutter Cristian Riveros PUC Chile PUC Chile PUC Chile R&M Tech marenas@ing.puc.cl jperez@ing.puc.cl

More information

Chapter 6 The Relational Algebra and Calculus

Chapter 6 The Relational Algebra and Calculus Chapter 6 The Relational Algebra and Calculus 1 Chapter Outline Example Database Application (COMPANY) Relational Algebra Unary Relational Operations Relational Algebra Operations From Set Theory Binary

More information

More on SQL Nested Queries Aggregate operators and Nulls

More on SQL Nested Queries Aggregate operators and Nulls Today s Lecture More on SQL Nested Queries Aggregate operators and Nulls Winter 2003 R ecom m en ded R eadi n g s Chapter 5 Section 5.4-5.6 http://philip.greenspun.com/sql/ Simple queries, more complex

More information

SQL. Dean Williamson, Ph.D. Assistant Vice President Institutional Research, Effectiveness, Analysis & Accreditation Prairie View A&M University

SQL. Dean Williamson, Ph.D. Assistant Vice President Institutional Research, Effectiveness, Analysis & Accreditation Prairie View A&M University SQL Dean Williamson, Ph.D. Assistant Vice President Institutional Research, Effectiveness, Analysis & Accreditation Prairie View A&M University SQL 1965: Maron & Levien propose Relational Data File 1968:

More information

Query Processing SL03

Query Processing SL03 Distributed Database Systems Fall 2016 Query Processing Overview Query Processing SL03 Distributed Query Processing Steps Query Decomposition Data Localization Query Processing Overview/1 Query processing:

More information

Predicate Logic CHAPTER What This Chapter Is About

Predicate Logic CHAPTER What This Chapter Is About CHAPTER 14 Predicate Logic We now turn our attention to a generalization of propositional logic, called predicate, or first-order, logic. Predicates are functions of zero or more variables that return

More information

15-819M: Data, Code, Decisions

15-819M: Data, Code, Decisions 15-819M: Data, Code, Decisions 08: First-Order Logic André Platzer aplatzer@cs.cmu.edu Carnegie Mellon University, Pittsburgh, PA André Platzer (CMU) 15-819M/08: Data, Code, Decisions 1 / 40 Outline 1

More information

Propositional Logic Formal Syntax and Semantics. Computability and Logic

Propositional Logic Formal Syntax and Semantics. Computability and Logic Propositional Logic Formal Syntax and Semantics Computability and Logic Syntax and Semantics Syntax: The study of how expressions are structured (think: grammar) Semantics: The study of the relationship

More information

Relational Query Languages: Relational Algebra. Juliana Freire

Relational Query Languages: Relational Algebra. Juliana Freire Relational Query Languages: Relational Algebra Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database. Relational model supports simple, powerful QLs: Simple

More information

CS34800 Information Systems. The Relational Model Prof. Walid Aref 29 August, 2016

CS34800 Information Systems. The Relational Model Prof. Walid Aref 29 August, 2016 CS34800 Information Systems The Relational Model Prof. Walid Aref 29 August, 2016 1 Chapter: The Relational Model Structure of Relational Databases Relational Algebra Tuple Relational Calculus Domain Relational

More information

DATABASE THEORY. Lecture 18: Dependencies. TU Dresden, 3rd July Markus Krötzsch Knowledge-Based Systems

DATABASE THEORY. Lecture 18: Dependencies. TU Dresden, 3rd July Markus Krötzsch Knowledge-Based Systems DATABASE THEORY Lecture 18: Dependencies Markus Krötzsch Knowledge-Based Systems TU Dresden, 3rd July 2018 Review: Databases and their schemas Lines: Line Type 85 bus 3 tram F1 ferry...... Stops: SID Stop

More information

Review Material: First Order Logic (FOL)

Review Material: First Order Logic (FOL) Information Integration on the WEB with RDF, OWL and SPARQL Review Material: First Order Logic (FOL) Grant Weddell October 7, 2013 Syntax of FOL Signatures Vocabularies are called signatures in FOL. The

More information

Unit 4 Relational Algebra (Using SQL DML Syntax): Data Manipulation Language For Relations Zvi M. Kedem 1

Unit 4 Relational Algebra (Using SQL DML Syntax): Data Manipulation Language For Relations Zvi M. Kedem 1 Unit 4 Relational Algebra (Using SQL DML Syntax): Data Manipulation Language For Relations 2014 Zvi M. Kedem 1 Relational Algebra And SQL SQL is based on relational algebra with many extensions Some necessary

More information

Chapter Seven: Regular Expressions. Formal Language, chapter 7, slide 1

Chapter Seven: Regular Expressions. Formal Language, chapter 7, slide 1 Chapter Seven: Regular Expressions Formal Language, chapter 7, slide The first time a young student sees the mathematical constant π, it looks like just one more school artifact: one more arbitrary symbol

More information

Introductory logic and sets for Computer scientists

Introductory logic and sets for Computer scientists Introductory logic and sets for Computer scientists Nimal Nissanke University of Reading ADDISON WESLEY LONGMAN Harlow, England II Reading, Massachusetts Menlo Park, California New York Don Mills, Ontario

More information

Optimization of Nested Queries in a Complex Object Model

Optimization of Nested Queries in a Complex Object Model Optimization of Nested Queries in a Complex Object Model Based on the papers: From Nested loops to Join Queries in OODB and Optimisation if Nested Queries in a Complex Object Model by Department of Computer

More information