Relational Algebra SPJRUD

Size: px
Start display at page:

Download "Relational Algebra SPJRUD"

Transcription

1 Relational Algebra SPJRUD Jef Wijsen Université de Mons (UMONS) May 14, 2018 Jef Wijsen (Université de Mons (UMONS)) SPJRUD May 14, / 1

2 Tabular Representation The table A B C is shorthand for the following set of tuples: {A : 1, B : 3, C : 2}, {A : 1, B : 4, C : 1}, {A : 2, B : 4, C : 2}, {A : 2, B : 3, C : 1}. Jef Wijsen (Université de Mons (UMONS)) SPJRUD May 14, / 1

3 Notation Every tuple is a total function from a set of attributes to the set of constants. Therefore, if t = {A : 1, B : 3, C : 2}, then t(b) = 3 and t[{a, C}] = {A : 1, C : 2}. Note that t(b) is a constant, and t[{a, C}] a tuple. In database theory, we often omit curly brackets ({}) and union symbols ( ) in the notation of sets. For example, if A, B, C, D are attributes and X = {A, B}, then XCD denotes the set {A, B, C, D}. Jef Wijsen (Université de Mons (UMONS)) SPJRUD May 14, / 1

4 Algebraic Operators Unary operators: Select, Project, Rename Binary operators: Join, Union, Difference Unary operators take in a single relation; binary operators take in two relations. Every operator returns a single relation. Jef Wijsen (Université de Mons (UMONS)) SPJRUD May 14, / 1

5 Select R A B C σ A= 1 (R) A B C σ A=C (R) A B C This is like SELECT * FROM R WHERE A="1" in SQL. Jef Wijsen (Université de Mons (UMONS)) SPJRUD May 14, / 1

6 Project R A B C π {A,B} (R) A B Since relations are sets, duplicates are removed. Note that SELECT A, B FROM R in SQL does not remove duplicates. Jef Wijsen (Université de Mons (UMONS)) SPJRUD May 14, / 1

7 Join R A B C S B C D R S A B C D R S contains all tuples t such that t[abc] is in R, and t[bcd] in S. This is different from the cross product SELECT * FROM R, S in SQL. Jef Wijsen (Université de Mons (UMONS)) SPJRUD May 14, / 1

8 Rename R A B C ρ C D (R) A B D Jef Wijsen (Université de Mons (UMONS)) SPJRUD May 14, / 1

9 Union R A B C S A B C R S A B C R S is only allowed if R and S have exactly the same attributes. In SQL, (SELECT * FROM R) UNION (SELECT * FROM S) only requires that R and S have the same number of attributes. The result takes the attributes of R. Jef Wijsen (Université de Mons (UMONS)) SPJRUD May 14, / 1

10 Difference R A B C S A B C R S A B C R S is only allowed if R and S have exactly the same attributes. In SQL, (SELECT * FROM R) MINUS (SELECT * FROM S) only requires that R and S have the same number of attributes. The result takes the attributes of R. Jef Wijsen (Université de Mons (UMONS)) SPJRUD May 14, / 1

11 Alphabet Relation names. Each relation name R is associated with a fixed set of attributes, denoted sort(r). Constants. Typically, R, S, T are relation names; A, B, C are attributes; a, b, c are constants. Jef Wijsen (Université de Mons (UMONS)) SPJRUD May 14, / 1

12 Syntax I Relation names Every relation name is an algebra expression. Selection If E is an algebra expression, A sort(e), and c is a constant, then σ A=c (E) is an algebra expression with sort(σ A=c (E)) = sort(e). Selection If E is an algebra expression and A, B sort(e), then σ A=B (E) is an algebra expression with sort(σ A=B (E)) = sort(e). Projection If E is an algebra expression and X sort(e), then π X (E) is an algebra expression with sort(π X (E)) = X. Join If E 1 and E 2 are algebra expressions, then E 1 E 2 is an algebra expression with sort(e 1 E 2 ) = sort(e 1 ) sort(e 2 ). Rename If E is an algebra expression, A sort(e), and B is an attribute not in sort(e), then ρ A B (E) is an algebra expression with sort(ρ A B (E)) = (sort(e) \ {A}) {B}. Jef Wijsen (Université de Mons (UMONS)) SPJRUD May 14, / 1

13 Syntax II Union If E 1 and E 2 are algebra expressions with sort(e 1 ) = sort(e 2 ), then E 1 E 2 is an algebra expression with sort(e 1 E 2 ) = sort(e 1 ). Difference If E 1 and E 2 are algebra expressions with sort(e 1 ) = sort(e 2 ), then E 1 E 2 is an algebra expression with sort(e 1 E 2 ) = sort(e 1 ). Jef Wijsen (Université de Mons (UMONS)) SPJRUD May 14, / 1

14 Semantics I A database I is a total function that maps every relation name R to a relation over sort(r). We denote by R I the relation to which R is mapped by I. For every relation name R, R I = R I. σ A=c (E) I = {t E I t(a) = c}. σ A=B (E) I = {t E I t(a) = t(b)}. π X (E) I = {t[x ] t E I }. Assume sort(e 1 ) = X and sort(e 2 ) = Y. Then, E 1 E 2 I = {t t[x ] E 1 I and t[y ] E 2 I }. ρ A B (E) I contains every tuple that can be obtained by replacing A with B in some tuple of E I. E 1 E 2 I = E 1 I E 2 I, where is the standard union of sets. E 1 E 2 I = E 1 I \ E 2 I. Jef Wijsen (Université de Mons (UMONS)) SPJRUD May 14, / 1

15 Examples VINS Cru Millesime Qualite Chablis 1992 excellent Chablis 1993 bon Rothschild 1993 bon Rothschild 1994 imbuvable ABUS Nom Cru Annee Ed Chablis 1992 Ed Chablis 1993 An Chablis 1993 An Rothschild 1993 Jef Wijsen (Université de Mons (UMONS)) SPJRUD May 14, / 1

16 Qui n a jamais bu un vin excellent? Soit E 1 = ρ Annee Millesime (ABUS) E 2 = σ Qualite= excellent (VINS) E 3 = π Nom (E 1 E 2 ) E 3 rend les personnes ayant déjà bu un vin excellent. La requête demandée est donc : π Nom (ABUS) E 3 Jef Wijsen (Université de Mons (UMONS)) SPJRUD May 14, / 1

17 Discussion Can we express all interesting queries in SPJRUD, or should we add more operators? Why don t we have intersection? Why don t we have σ A B R? S Show the following: if we leave out one of the 6 operators, then we can express strictly less queries. Hint: For union, consider two relations R A 1 and A. Show that if E is an 0 A algebraic expression that does not contain, then E will not return 0 on 1 input R and S (and therefore, E does not express R S). Jef Wijsen (Université de Mons (UMONS)) SPJRUD May 14, / 1

Relational Algebra on Bags. Why Bags? Operations on Bags. Example: Bag Selection. σ A+B < 5 (R) = A B

Relational Algebra on Bags. Why Bags? Operations on Bags. Example: Bag Selection. σ A+B < 5 (R) = A B Relational Algebra on Bags Why Bags? 13 14 A bag (or multiset ) is like a set, but an element may appear more than once. Example: {1,2,1,3} is a bag. Example: {1,2,3} is also a bag that happens to be a

More information

Tuple Relational Calculus

Tuple Relational Calculus Tuple Relational Calculus Université de Mons (UMONS) May 14, 2018 Motivation S[S#, SNAME, STATUS, CITY] P[P#, PNAME, COLOR, WEIGHT, CITY] SP[S#, P#, QTY)] Get all pairs of city names such that a supplier

More information

Relational Algebra Part 1. Definitions.

Relational Algebra Part 1. Definitions. .. Cal Poly pring 2016 CPE/CC 365 Introduction to Database ystems Alexander Dekhtyar Eriq Augustine.. elational Algebra Notation, T,,... relations. t, t 1, t 2,... tuples of relations. t (n tuple with

More information

α-acyclic Joins Jef Wijsen May 4, 2017

α-acyclic Joins Jef Wijsen May 4, 2017 α-acyclic Joins Jef Wijsen May 4, 2017 1 Motivation Joins in a Distributed Environment Assume the following relations. 1 M[NN, Field of Study, Year] stores data about students of UMONS. For example, (19950423158,

More information

Databases 2011 The Relational Algebra

Databases 2011 The Relational Algebra Databases 2011 Christian S. Jensen Computer Science, Aarhus University What is an Algebra? An algebra consists of values operators rules Closure: operations yield values Examples integers with +,, sets

More information

Query Processing. 3 steps: Parsing & Translation Optimization Evaluation

Query Processing. 3 steps: Parsing & Translation Optimization Evaluation rela%onal algebra Query Processing 3 steps: Parsing & Translation Optimization Evaluation 30 Simple set of algebraic operations on relations Journey of a query SQL select from where Rela%onal algebra π

More information

Movies Title Director Actor

Movies Title Director Actor Movies Title Director Actor The Trouble with Harry Hitchcock Gwenn The Trouble with Harry Hitchcock Forsythe The Trouble with Harry Hitchcock MacLaine The Trouble with Harry Hitchcock Hitchcock Cries and

More information

Logic and Databases. Phokion G. Kolaitis. UC Santa Cruz & IBM Research Almaden. Lecture 4 Part 1

Logic and Databases. Phokion G. Kolaitis. UC Santa Cruz & IBM Research Almaden. Lecture 4 Part 1 Logic and Databases Phokion G. Kolaitis UC Santa Cruz & IBM Research Almaden Lecture 4 Part 1 1 Thematic Roadmap Logic and Database Query Languages Relational Algebra and Relational Calculus Conjunctive

More information

Basic Equations and Inequalities. An equation is a statement that the values of two expressions are equal.

Basic Equations and Inequalities. An equation is a statement that the values of two expressions are equal. Hartfield College Algebra (Version 2018 - Thomas Hartfield) Unit ZERO Page - 1 - of 7 Topic 0: Definition: Ex. 1 Basic Equations and Inequalities An equation is a statement that the values of two expressions

More information

7 RC Simulates RA. Lemma: For every RA expression E(A 1... A k ) there exists a DRC formula F with F V (F ) = {A 1,..., A k } and

7 RC Simulates RA. Lemma: For every RA expression E(A 1... A k ) there exists a DRC formula F with F V (F ) = {A 1,..., A k } and 7 RC Simulates RA. We now show that DRC (and hence TRC) is at least as expressive as RA. That is, given an RA expression E that mentions at most C, there is an equivalent DRC expression E that mentions

More information

1 First-order logic. 1 Syntax of first-order logic. 2 Semantics of first-order logic. 3 First-order logic queries. 2 First-order query evaluation

1 First-order logic. 1 Syntax of first-order logic. 2 Semantics of first-order logic. 3 First-order logic queries. 2 First-order query evaluation Knowledge Bases and Databases Part 1: First-Order Queries Diego Calvanese Faculty of Computer Science Master of Science in Computer Science A.Y. 2007/2008 Overview of Part 1: First-order queries 1 First-order

More information

Plan of the lecture. G53RDB: Theory of Relational Databases Lecture 2. More operations: renaming. Previous lecture. Renaming.

Plan of the lecture. G53RDB: Theory of Relational Databases Lecture 2. More operations: renaming. Previous lecture. Renaming. Plan of the lecture G53RDB: Theory of Relational Lecture 2 Natasha Alechina chool of Computer cience & IT nza@cs.nott.ac.uk Renaming Joins Definability of intersection Division ome properties of relational

More information

Introduction to Data Management. Lecture #12 (Relational Algebra II)

Introduction to Data Management. Lecture #12 (Relational Algebra II) Introduction to Data Management Lecture #12 (Relational Algebra II) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v HW and exams:

More information

CS632 Notes on Relational Query Languages I

CS632 Notes on Relational Query Languages I CS632 Notes on Relational Query Languages I A. Demers 6 Feb 2003 1 Introduction Here we define relations, and introduce our notational conventions, which are taken almost directly from [AD93]. We begin

More information

Relational Algebra and Calculus

Relational Algebra and Calculus Topics Relational Algebra and Calculus Linda Wu Formal query languages Preliminaries Relational algebra Relational calculus Expressive power of algebra and calculus (CMPT 354 2004-2) Chapter 4 CMPT 354

More information

Relational Algebra & Calculus

Relational Algebra & Calculus Relational Algebra & Calculus Yanlei Diao UMass Amherst Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 Outline v Conceptual Design: ER model v Logical Design: ER to relational model v Querying and

More information

CS54100: Database Systems

CS54100: Database Systems CS54100: Database Systems Relational Algebra 3 February 2012 Prof. Walid Aref Core Relational Algebra A small set of operators that allow us to manipulate relations in limited but useful ways. The operators

More information

INTRODUCTION TO RELATIONAL DATABASE SYSTEMS

INTRODUCTION TO RELATIONAL DATABASE SYSTEMS INTRODUCTION TO RELATIONAL DATABASE SYSTEMS DATENBANKSYSTEME 1 (INF 3131) Torsten Grust Universität Tübingen Winter 2017/18 1 THE RELATIONAL ALGEBRA The Relational Algebra (RA) is a query language for

More information

Schedule. Today: Jan. 17 (TH) Jan. 24 (TH) Jan. 29 (T) Jan. 22 (T) Read Sections Assignment 2 due. Read Sections Assignment 3 due.

Schedule. Today: Jan. 17 (TH) Jan. 24 (TH) Jan. 29 (T) Jan. 22 (T) Read Sections Assignment 2 due. Read Sections Assignment 3 due. Schedule Today: Jan. 17 (TH) Relational Algebra. Read Chapter 5. Project Part 1 due. Jan. 22 (T) SQL Queries. Read Sections 6.1-6.2. Assignment 2 due. Jan. 24 (TH) Subqueries, Grouping and Aggregation.

More information

Chapter 3 Relational Model

Chapter 3 Relational Model Chapter 3 Relational Model Table of Contents 1. Structure of Relational Databases 2. Relational Algebra 3. Tuple Relational Calculus 4. Domain Relational Calculus Chapter 3-1 1 1. Structure of Relational

More information

CSE 562 Database Systems

CSE 562 Database Systems Outline Query Optimization CSE 562 Database Systems Query Processing: Algebraic Optimization Some slides are based or modified from originals by Database Systems: The Complete Book, Pearson Prentice Hall

More information

The Query Containment Problem: Set Semantics vs. Bag Semantics. Phokion G. Kolaitis University of California Santa Cruz & IBM Research - Almaden

The Query Containment Problem: Set Semantics vs. Bag Semantics. Phokion G. Kolaitis University of California Santa Cruz & IBM Research - Almaden The Query Containment Problem: Set Semantics vs. Bag Semantics Phokion G. Kolaitis University of California Santa Cruz & IBM Research - Almaden PROBLEMS Problems worthy of attack prove their worth by hitting

More information

ClC (X ) : X ω X } C. (11)

ClC (X ) : X ω X } C. (11) With each closed-set system we associate a closure operation. Definition 1.20. Let A, C be a closed-set system. Define Cl C : : P(A) P(A) as follows. For every X A, Cl C (X) = { C C : X C }. Cl C (X) is

More information

Lecture 2: Syntax. January 24, 2018

Lecture 2: Syntax. January 24, 2018 Lecture 2: Syntax January 24, 2018 We now review the basic definitions of first-order logic in more detail. Recall that a language consists of a collection of symbols {P i }, each of which has some specified

More information

Relational Algebra 2. Week 5

Relational Algebra 2. Week 5 Relational Algebra 2 Week 5 Relational Algebra (So far) Basic operations: Selection ( σ ) Selects a subset of rows from relation. Projection ( π ) Deletes unwanted columns from relation. Cross-product

More information

Equational Logic. Chapter Syntax Terms and Term Algebras

Equational Logic. Chapter Syntax Terms and Term Algebras Chapter 2 Equational Logic 2.1 Syntax 2.1.1 Terms and Term Algebras The natural logic of algebra is equational logic, whose propositions are universally quantified identities between terms built up from

More information

Factorised Representations of Query Results: Size Bounds and Readability

Factorised Representations of Query Results: Size Bounds and Readability Factorised Representations of Query Results: Size Bounds and Readability Dan Olteanu and Jakub Závodný Department of Computer Science University of Oxford {dan.olteanu,jakub.zavodny}@cs.ox.ac.uk ABSTRACT

More information

Database Applications (15-415)

Database Applications (15-415) Database Applications (15-415) Relational Calculus Lecture 5, January 27, 2014 Mohammad Hammoud Today Last Session: Relational Algebra Today s Session: Relational algebra The division operator and summary

More information

CS145 Midterm Examination

CS145 Midterm Examination S145 Midterm Examination Please read all instructions (including these) carefully. The exam is open book and open notes; any written materials may be used. There are four parts on the exam, with a varying

More information

Expiration of Historical Databases

Expiration of Historical Databases Expiration of Historical Databases (Extended Abstract) David Toman Department of Computer Science, University of Waterloo Waterloo, Ontario, Canada N2L 3G1 E-mail: david@uwaterloo.ca Abstract We present

More information

FIRST-ORDER QUERY EVALUATION ON STRUCTURES OF BOUNDED DEGREE

FIRST-ORDER QUERY EVALUATION ON STRUCTURES OF BOUNDED DEGREE FIRST-ORDER QUERY EVALUATION ON STRUCTURES OF BOUNDED DEGREE INRIA and ENS Cachan e-mail address: kazana@lsv.ens-cachan.fr WOJCIECH KAZANA AND LUC SEGOUFIN INRIA and ENS Cachan e-mail address: see http://pages.saclay.inria.fr/luc.segoufin/

More information

Chapter 0 Introduction. Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin

Chapter 0 Introduction. Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin Chapter 0 Introduction Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin October 2014 Automata Theory 2 of 22 Automata theory deals

More information

P Q1 Q2 Q3 Q4 Q5 Tot (60) (20) (20) (20) (60) (20) (200) You are allotted a maximum of 4 hours to complete this exam.

P Q1 Q2 Q3 Q4 Q5 Tot (60) (20) (20) (20) (60) (20) (200) You are allotted a maximum of 4 hours to complete this exam. Exam INFO-H-417 Database System Architecture 13 January 2014 Name: ULB Student ID: P Q1 Q2 Q3 Q4 Q5 Tot (60 (20 (20 (20 (60 (20 (200 Exam modalities You are allotted a maximum of 4 hours to complete this

More information

Lecture 12. Statement Logic as a word algebra on the set of atomic statements. Lindenbaum algebra.

Lecture 12. Statement Logic as a word algebra on the set of atomic statements. Lindenbaum algebra. V. Borschev and B. Partee, October 26, 2006 p. 1 Lecture 12. Statement Logic as a word algebra on the set of atomic statements. Lindenbaum algebra. 0. Preliminary notes...1 1. Freedom for algebras. Word

More information

Relational Algebra as non-distributive Lattice

Relational Algebra as non-distributive Lattice Relational Algebra as non-distributive Lattice VADIM TROPASHKO Vadim.Tropashko@orcl.com We reduce the set of classic relational algebra operators to two binary operations: natural join and generalized

More information

Database Applications (15-415)

Database Applications (15-415) Database Applications (15-415) Relational Calculus Lecture 6, January 26, 2016 Mohammad Hammoud Today Last Session: Relational Algebra Today s Session: Relational calculus Relational tuple calculus Announcements:

More information

2.5 Compound Inequalities

2.5 Compound Inequalities Section.5 Compound Inequalities 89.5 Compound Inequalities S 1 Find the Intersection of Two Sets. Solve Compound Inequalities Containing and. Find the Union of Two Sets. 4 Solve Compound Inequalities Containing

More information

Computational Logic. Relational Query Languages with Negation. Free University of Bozen-Bolzano, Werner Nutt

Computational Logic. Relational Query Languages with Negation. Free University of Bozen-Bolzano, Werner Nutt Computational Logic Free University of Bozen-Bolzano, 2010 Werner Nutt (Slides adapted from Thomas Eiter and Leonid Libkin) Computational Logic 1 Queries with All Who are the directors whose movies are

More information

From Constructibility and Absoluteness to Computability and Domain Independence

From Constructibility and Absoluteness to Computability and Domain Independence From Constructibility and Absoluteness to Computability and Domain Independence Arnon Avron School of Computer Science Tel Aviv University, Tel Aviv 69978, Israel aa@math.tau.ac.il Abstract. Gödel s main

More information

The non-logical symbols determine a specific F OL language and consists of the following sets. Σ = {Σ n } n<ω

The non-logical symbols determine a specific F OL language and consists of the following sets. Σ = {Σ n } n<ω 1 Preliminaries In this chapter we first give a summary of the basic notations, terminology and results which will be used in this thesis. The treatment here is reduced to a list of definitions. For the

More information

CS2742 midterm test 2 study sheet. Boolean circuits: Predicate logic:

CS2742 midterm test 2 study sheet. Boolean circuits: Predicate logic: x NOT ~x x y AND x /\ y x y OR x \/ y Figure 1: Types of gates in a digital circuit. CS2742 midterm test 2 study sheet Boolean circuits: Boolean circuits is a generalization of Boolean formulas in which

More information

Relational completeness of query languages for annotated databases

Relational completeness of query languages for annotated databases Relational completeness of query languages for annotated databases Floris Geerts 1,2 and Jan Van den Bussche 1 1 Hasselt University/Transnational University Limburg 2 University of Edinburgh Abstract.

More information

QSQL: Incorporating Logic-based Retrieval Conditions into SQL

QSQL: Incorporating Logic-based Retrieval Conditions into SQL QSQL: Incorporating Logic-based Retrieval Conditions into SQL Sebastian Lehrack and Ingo Schmitt Brandenburg University of Technology Cottbus Institute of Computer Science Chair of Database and Information

More information

CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #3: SQL---Part 1

CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #3: SQL---Part 1 CS 4604: Introduc0on to Database Management Systems B. Aditya Prakash Lecture #3: SQL---Part 1 Announcements---Project Goal: design a database system applica=on with a web front-end Project Assignment

More information

7.13 7.14 7.15 J J WHERE CITY = 'London' ( SPJ WHERE J# = J# ( 'J1' ) ) { S# } 7.16 SPJ WHERE QTY QTY ( 300 ) AND QTY QTY ( 750 ) 7.17 7.18 7.19 7.20 7.21 P { COLOR, CITY } ( S JOIN P JOIN J ) { S#, P#,

More information

MA5219 LOGIC AND FOUNDATION OF MATHEMATICS I. Lecture 1: Programs. Tin Lok Wong 13 August, 2018

MA5219 LOGIC AND FOUNDATION OF MATHEMATICS I. Lecture 1: Programs. Tin Lok Wong 13 August, 2018 MA5219 LOGIC AND FOUNDATION OF MATHEMATICS I Lecture 1: Programs Tin Lok Wong 13 August, 2018 The aim of this lecture is to characterize S N : some algorithm can tell whether n N belongs to S}. By an algorithm

More information

A Logical Formulation of the Granular Data Model

A Logical Formulation of the Granular Data Model 2008 IEEE International Conference on Data Mining Workshops A Logical Formulation of the Granular Data Model Tuan-Fang Fan Department of Computer Science and Information Engineering National Penghu University

More information

RQL: a Query Language for Implications

RQL: a Query Language for Implications RQL: a Query Language for Implications Jean-Marc Petit (joint work with B. Chardin, E. Coquery and M. Pailloux) INSA Lyon CNRS and Université de Lyon Dagstuhl Seminar 12-16 May 2014 Horn formulas, directed

More information

Sets. Introduction to Set Theory ( 2.1) Basic notations for sets. Basic properties of sets CMSC 302. Vojislav Kecman

Sets. Introduction to Set Theory ( 2.1) Basic notations for sets. Basic properties of sets CMSC 302. Vojislav Kecman Introduction to Set Theory ( 2.1) VCU, Department of Computer Science CMSC 302 Sets Vojislav Kecman A set is a new type of structure, representing an unordered collection (group, plurality) of zero or

More information

CS 347 Parallel and Distributed Data Processing

CS 347 Parallel and Distributed Data Processing CS 347 Parallel and Distributed Data Processing Spring 2016 Notes 3: Query Processing Query Processing Decomposition Localization Optimization CS 347 Notes 3 2 Decomposition Same as in centralized system

More information

You are here! Query Processor. Recovery. Discussed here: DBMS. Task 3 is often called algebraic (or re-write) query optimization, while

You are here! Query Processor. Recovery. Discussed here: DBMS. Task 3 is often called algebraic (or re-write) query optimization, while Module 10: Query Optimization Module Outline 10.1 Outline of Query Optimization 10.2 Motivating Example 10.3 Equivalences in the relational algebra 10.4 Heuristic optimization 10.5 Explosion of search

More information

6 The Relational Data Model: Algebraic operations on tabular data

6 The Relational Data Model: Algebraic operations on tabular data 6 The Relational Data Model: Algebraic operations on tabular data 6.1 Basic idea of relational languages 6.2 Relational Algebra operations 6.3 Relational Algebra: Syntax and Semantics 6.4. More Operators

More information

Propositional and Predicate Logic - VII

Propositional and Predicate Logic - VII Propositional and Predicate Logic - VII Petr Gregor KTIML MFF UK WS 2015/2016 Petr Gregor (KTIML MFF UK) Propositional and Predicate Logic - VII WS 2015/2016 1 / 11 Theory Validity in a theory A theory

More information

First-Order Expressibility Results for Queries over Inconsistent DL-Lite Knowledge Bases

First-Order Expressibility Results for Queries over Inconsistent DL-Lite Knowledge Bases Author manuscript, published in "24th International Workshop on Description Logics (DL 2011) Spain (2011)" First-Order Expressibility esults for Queries over Inconsistent DL-Lite Knowledge Bases Meghyn

More information

Tecniche di Verifica. Introduction to Propositional Logic

Tecniche di Verifica. Introduction to Propositional Logic Tecniche di Verifica Introduction to Propositional Logic 1 Logic A formal logic is defined by its syntax and semantics. Syntax An alphabet is a set of symbols. A finite sequence of these symbols is called

More information

First Steps in Relational Lattice

First Steps in Relational Lattice First Steps in Relational Lattice MARSHALL SPIGHT Marshall.Spight@gmai1.com VADIM TROPASHKO Vadim.Tropashko@orcl.com Relational lattice reduces the set of si classic relational algebra operators to two

More information

CM10196 Topic 2: Sets, Predicates, Boolean algebras

CM10196 Topic 2: Sets, Predicates, Boolean algebras CM10196 Topic 2: Sets, Predicates, oolean algebras Guy McCusker 1W2.1 Sets Most of the things mathematicians talk about are built out of sets. The idea of a set is a simple one: a set is just a collection

More information

Module 10: Query Optimization

Module 10: Query Optimization Module 10: Query Optimization Module Outline 10.1 Outline of Query Optimization 10.2 Motivating Example 10.3 Equivalences in the relational algebra 10.4 Heuristic optimization 10.5 Explosion of search

More information

Chapter 2: Introduction to Propositional Logic

Chapter 2: Introduction to Propositional Logic Chapter 2: Introduction to Propositional Logic PART ONE: History and Motivation Origins: Stoic school of philosophy (3rd century B.C.), with the most eminent representative was Chryssipus. Modern Origins:

More information

Relations. We have seen several types of abstract, mathematical objects, including propositions, predicates, sets, and ordered pairs and tuples.

Relations. We have seen several types of abstract, mathematical objects, including propositions, predicates, sets, and ordered pairs and tuples. Relations We have seen several types of abstract, mathematical objects, including propositions, predicates, sets, and ordered pairs and tuples. Relations use ordered tuples to represent relationships among

More information

A Dichotomy. in in Probabilistic Databases. Joint work with Robert Fink. for Non-Repeating Queries with Negation Queries with Negation

A Dichotomy. in in Probabilistic Databases. Joint work with Robert Fink. for Non-Repeating Queries with Negation Queries with Negation Dichotomy for Non-Repeating Queries with Negation Queries with Negation in in Probabilistic Databases Robert Dan Olteanu Fink and Dan Olteanu Joint work with Robert Fink Uncertainty in Computation Simons

More information

Today s topics. Introduction to Set Theory ( 1.6) Naïve set theory. Basic notations for sets

Today s topics. Introduction to Set Theory ( 1.6) Naïve set theory. Basic notations for sets Today s topics Introduction to Set Theory ( 1.6) Sets Definitions Operations Proving Set Identities Reading: Sections 1.6-1.7 Upcoming Functions A set is a new type of structure, representing an unordered

More information

Information Systems for Engineers. Exercise 8. ETH Zurich, Fall Semester Hand-out Due

Information Systems for Engineers. Exercise 8. ETH Zurich, Fall Semester Hand-out Due Information Systems for Engineers Exercise 8 ETH Zurich, Fall Semester 2017 Hand-out 24.11.2017 Due 01.12.2017 1. (Exercise 3.3.1 in [1]) For each of the following relation schemas and sets of FD s, i)

More information

Temporal Constraint Networks

Temporal Constraint Networks Ch. 6b p.1/49 Temporal Constraint Networks Addition to Chapter 6 Ch. 6b p.2/49 Outline Temporal reasoning Qualitative networks The interval algebra The point algebra Quantitative temporal networks Reference:

More information

B.3 Solving Equations Algebraically and Graphically

B.3 Solving Equations Algebraically and Graphically B.3 Solving Equations Algebraically and Graphically 1 Equations and Solutions of Equations An equation in x is a statement that two algebraic expressions are equal. To solve an equation in x means to find

More information

An Extended Relational Algebra for Declarative Programming *

An Extended Relational Algebra for Declarative Programming * An Extended Relational Algebra for Declarative Programming * Jesús M. Almendros-Jiménez Dpto. de Lenguajes y Computación. Universidad de Almería. jalmen@ual.es Resumen Relational algebra is a well-known

More information

Relational-Database Design

Relational-Database Design C H A P T E R 7 Relational-Database Design Exercises 7.2 Answer: A decomposition {R 1, R 2 } is a lossless-join decomposition if R 1 R 2 R 1 or R 1 R 2 R 2. Let R 1 =(A, B, C), R 2 =(A, D, E), and R 1

More information

Database Design and Implementation

Database Design and Implementation Database Design and Implementation CS 645 Data provenance Provenance provenance, n. The fact of coming from some particular source or quarter; origin, derivation [Oxford English Dictionary] Data provenance

More information

arxiv: v2 [cs.db] 26 Jan 2018

arxiv: v2 [cs.db] 26 Jan 2018 Possible and Certain Answers for Queries over Order-Incomplete Data Antoine Amarilli 1, Mouhamadou Lamine Ba 2, Daniel Deutch 3, and Pierre Senellart 4,5 1 LTCI, Télécom ParisTech, Université Paris-Saclay;

More information

Database Systems SQL. A.R. Hurson 323 CS Building

Database Systems SQL. A.R. Hurson 323 CS Building SQL A.R. Hurson 323 CS Building Structured Query Language (SQL) The SQL language has the following features as well: Embedded and Dynamic facilities to allow SQL code to be called from a host language

More information

What is a constant? A Constant is a number representing a quantity or value that does not change.

What is a constant? A Constant is a number representing a quantity or value that does not change. Worksheet -: Algebraic Expressions What is a constant? A Constant is a number representing a quantity or value that does not change. What is a variable? A variable is a letter or symbol representing a

More information

1) 2) Algebra (3-2) Solving Inequalities with Additon and Subtraction

1) 2) Algebra (3-2) Solving Inequalities with Additon and Subtraction Algebra (3-2) Solving Inequalities with Additon and Subtraction N# The Equality Properties of Addition and Subtraction also apply to INEQUALITIES. If you or the same value to each side of an inequality,

More information

Query Evaluation on Probabilistic Databases. CSE 544: Wednesday, May 24, 2006

Query Evaluation on Probabilistic Databases. CSE 544: Wednesday, May 24, 2006 Query Evaluation on Probabilistic Databases CSE 544: Wednesday, May 24, 2006 Problem Setting Queries: Tables: Review A(x,y) :- Review(x,y), Movie(x,z), z > 1991 name rating p Movie Monkey Love good.5 title

More information

GIS Lecture 4: Data. GIS Tutorial, Third Edition GIS 1

GIS Lecture 4: Data. GIS Tutorial, Third Edition GIS 1 GIS Lecture 4: Data GIS 1 Outline Data Types, Tables, and Formats Geodatabase Tabular Joins Spatial Joins Field Calculator ArcCatalog Functions GIS 2 Data Types, Tables, Formats GIS 3 Directly Loadable

More information

Algebra 1 Unit 6: Linear Inequalities and Absolute Value Guided Notes

Algebra 1 Unit 6: Linear Inequalities and Absolute Value Guided Notes Section 6.1: Solving Inequalities by Addition and Subtraction How do we solve the equation: x 12 = 65? How do we solve the equation: x 12 < 65? Graph the solution: Example 1: 12 y 9 Example 2: q + 23

More information

EECS-3421a: Test #2 Electrical Engineering & Computer Science York University

EECS-3421a: Test #2 Electrical Engineering & Computer Science York University 18 November 2015 EECS-3421a: Test #2 1 of 16 EECS-3421a: Test #2 Electrical Engineering & Computer Science York University Family Name: Given Name: Student#: CSE Account: Instructor: Parke Godfrey Exam

More information

Algorithms for Tensor Decomposition via Numerical Homotopy

Algorithms for Tensor Decomposition via Numerical Homotopy Algorithms for Tensor Decomposition via Numerical Homotopy Session on Algebraic Geometry of Tensor Decompositions August 3, 2013 This talk involves joint work and discussions with: Hirotachi Abo Dan Bates

More information

Design Theory: Functional Dependencies and Normal Forms, Part I Instructor: Shel Finkelstein

Design Theory: Functional Dependencies and Normal Forms, Part I Instructor: Shel Finkelstein Design Theory: Functional Dependencies and Normal Forms, Part I Instructor: Shel Finkelstein Reference: A First Course in Database Systems, 3 rd edition, Chapter 3 Important Notices CMPS 180 Final Exam

More information

Carnegie Mellon University Department of Computer Science /615 - Database Applications C. Faloutsos & A. Pavlo, Fall 2016

Carnegie Mellon University Department of Computer Science /615 - Database Applications C. Faloutsos & A. Pavlo, Fall 2016 Carnegie Mellon University Department of Computer Science 15-415/615 - Database Applications C. Faloutsos & A. Pavlo, Fall 2016 Homework 2 (by Lu Zhang) - Solutions Due: hard copy, in class at 3:00pm,

More information

This Lecture will Cover...

This Lecture will Cover... Last Lecture Covered... DFAs, NFAs, -NFAs and the equivalence of the language classes they accept Last Lecture Covered... This Lecture will Cover... Introduction to regular expressions and regular languages

More information

Parameterized Regular Expressions and Their Languages

Parameterized Regular Expressions and Their Languages Parameterized Regular Expressions and Their Languages Pablo Barceló a, Juan Reutter b, Leonid Libkin b a Department of Computer Science, University of Chile b School of Informatics, University of Edinburgh

More information

CS5371 Theory of Computation. Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression)

CS5371 Theory of Computation. Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression) CS5371 Theory of Computation Lecture 5: Automata Theory III (Non-regular Language, Pumping Lemma, Regular Expression) Objectives Prove the Pumping Lemma, and use it to show that there are non-regular languages

More information

Sets, Logic, Relations, and Functions

Sets, Logic, Relations, and Functions Sets, Logic, Relations, and Functions Andrew Kay September 28, 2014 Abstract This is an introductory text, not a comprehensive study; these notes contain mainly definitions, basic results, and examples.

More information

Factorized Relational Databases Olteanu and Závodný, University of Oxford

Factorized Relational Databases   Olteanu and Závodný, University of Oxford November 8, 2013 Database Seminar, U Washington Factorized Relational Databases http://www.cs.ox.ac.uk/projects/fd/ Olteanu and Závodný, University of Oxford Factorized Representations of Relations Cust

More information

Finite Math Section 6_1 Solutions and Hints

Finite Math Section 6_1 Solutions and Hints Finite Math Section 6_1 Solutions and Hints by Brent M. Dingle for the book: Finite Mathematics, 7 th Edition by S. T. Tan. DO NOT PRINT THIS OUT AND TURN IT IN!!!!!!!! This is designed to assist you in

More information

Advanced DB CHAPTER 5 DATALOG

Advanced DB CHAPTER 5 DATALOG Advanced DB CHAPTER 5 DATALOG Datalog Basic Structure Syntax of Datalog Rules Semantics of Nonrecursive Datalog Safety Relational Operations in Datalog Recursion in Datalog The Power of Recursion A More

More information

2-7 Solving Quadratic Inequalities. ax 2 + bx + c > 0 (a 0)

2-7 Solving Quadratic Inequalities. ax 2 + bx + c > 0 (a 0) Quadratic Inequalities In One Variable LOOKS LIKE a quadratic equation but Doesn t have an equal sign (=) Has an inequality sign (>,

More information

Relational Database: Identities of Relational Algebra; Example of Query Optimization

Relational Database: Identities of Relational Algebra; Example of Query Optimization Relational Database: Identities of Relational Algebra; Example of Query Optimization Greg Plaxton Theory in Programming Practice, Fall 2005 Department of Computer Science University of Texas at Austin

More information

Query answering using views

Query answering using views Query answering using views General setting: database relations R 1,...,R n. Several views V 1,...,V k are defined as results of queries over the R i s. We have a query Q over R 1,...,R n. Question: Can

More information

Euclidean Spaces. Euclidean Spaces. Chapter 10 -S&B

Euclidean Spaces. Euclidean Spaces. Chapter 10 -S&B Chapter 10 -S&B The Real Line: every real number is represented by exactly one point on the line. The plane (i.e., consumption bundles): Pairs of numbers have a geometric representation Cartesian plane

More information

Chapter 0: Sets and Numbers

Chapter 0: Sets and Numbers Haberman MTH 112 Section I: Periodic Functions and Trigonometry Chapter 0: Sets and Numbers DEFINITION: A set is a collection of objects specified in a manner that enables one to determine if a given object

More information

SPARQL Formalization

SPARQL Formalization SPARQL Formalization Marcelo Arenas, Claudio Gutierrez, Jorge Pérez Department of Computer Science Pontificia Universidad Católica de Chile Universidad de Chile Center for Web Research http://www.cwr.cl

More information

Languages. Theory I: Database Foundations. Relational Algebra. Paradigms. Projection. Basic Operators. Jan-Georg Smaus (Georg Lausen)

Languages. Theory I: Database Foundations. Relational Algebra. Paradigms. Projection. Basic Operators. Jan-Georg Smaus (Georg Lausen) Languages Theory I: Database Foundations Jan-Georg Smaus (Georg Lausen) Paradigms 1. Languages: Relational Algebra Projection Union and Difference Summary 26.7.2011 Relational algebra Relational calculus

More information

HW#2: Quads 7 #1 6. How do you find the answer to a Quadratic Inequality? 02Quad7 SolvingQuadraticInequalities Notes.notebook.

HW#2: Quads 7 #1 6. How do you find the answer to a Quadratic Inequality? 02Quad7 SolvingQuadraticInequalities Notes.notebook. Quadratics 7 Solving Quadratic Inequalities Standards: A REI.7, A REI.11, F IF.7a GLO: #3 Complex Thinker Math Practice: Reason abstractly & Quantitatively Learning Targets: How do you write inequality

More information

GAV-sound with conjunctive queries

GAV-sound with conjunctive queries GAV-sound with conjunctive queries Source and global schema as before: source R 1 (A, B),R 2 (B,C) Global schema: T 1 (A, C), T 2 (B,C) GAV mappings become sound: T 1 {x, y, z R 1 (x,y) R 2 (y,z)} T 2

More information

Lesson ACTIVITY: Tree Growth

Lesson ACTIVITY: Tree Growth Lesson 3.1 - ACTIVITY: Tree Growth Obj.: use arrow diagrams to represent expressions. evaluate expressions. write expressions to model realworld situations. Algebraic expression - A symbol or combination

More information

Schema Refinement & Normalization Theory: Functional Dependencies INFS-614 INFS614, GMU 1

Schema Refinement & Normalization Theory: Functional Dependencies INFS-614 INFS614, GMU 1 Schema Refinement & Normalization Theory: Functional Dependencies INFS-614 INFS614, GMU 1 Background We started with schema design ER model translation into a relational schema Then we studied relational

More information

Functional Dependencies. Getting a good DB design Lisa Ball November 2012

Functional Dependencies. Getting a good DB design Lisa Ball November 2012 Functional Dependencies Getting a good DB design Lisa Ball November 2012 Outline (2012) SEE NEXT SLIDE FOR ALL TOPICS (some for you to read) Normalization covered by Dr Sanchez Armstrong s Axioms other

More information

Correlated subqueries. Query Optimization. Magic decorrelation. COUNT bug. Magic example (slide 2) Magic example (slide 1)

Correlated subqueries. Query Optimization. Magic decorrelation. COUNT bug. Magic example (slide 2) Magic example (slide 1) Correlated subqueries Query Optimization CPS Advanced Database Systems SELECT CID FROM Course Executing correlated subquery is expensive The subquery is evaluated once for every CPS course Decorrelate!

More information

Part 2: First-Order Logic

Part 2: First-Order Logic Part 2: First-Order Logic First-order logic formalizes fundamental mathematical concepts is expressive (Turing-complete) is not too expressive (e. g. not axiomatizable: natural numbers, uncountable sets)

More information