CH4 EXERCISES 4.2. Given two relations R1 and R2, where R1 contains N1 tuples, R2 contains N2 tuples, and N2 > N1 > 0, give the min and max possible sizes.

Slides:



Advertisements
Similar presentations
Chapter 13: Query Processing
Advertisements

Information Systems & Semantic Web University of Koblenz Landau, Germany Advanced Data Modeling Relational Data Model continued Steffen Staab with Simon.
1 Datalog: Logic Instead of Algebra. 2 Datalog: Logic instead of Algebra Each relational-algebra operator can be mimicked by one or several Database Logic.
COP4540 Database Management System Midterm Review
1 Relational Algebra & Calculus Chapter 4, Part A (Relational Algebra) Query Formulation Exercise.
1 Database Systems 10.8, 2008 Lecture #4. 2 Course Administration Assignment #1 is due next Wed (outside 336/338). Course slides will now have black background.
More Slides on “Division Operation” in Relational Algebra Query Language (& together with examples on Assignment operation)
Review Session Monday, Oct 8 Shipra Agrawal. Announcements New Gradiance assignment deadline Wednesday, Oct 10 Please read FAQs for assignments.
(define (make-rat n d) (if (and (number? n) (number? d) (not (= d 0))) (cons n d) (error "cannot make a rat with denominator 0"))) (define (numer r) (head.
Lecture 4: Javascript Basics Javascript is a scripting language based on pieces of C, C++, shell scripts, Pascal, Java, etc. Scripts – loosely typed C++
1 Advanced SQL Queries. 2 Example Tables Used Reserves sidbidday /10/04 11/12/04 Sailors sidsnameratingage Dustin Lubber Rusty.
1 Relational Algebra* and Tuple Calculus * The slides in this lecture are adapted from slides used in Standford's CS145 course.
Relational Algebra Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY courtesy of Joe Hellerstein for some slides.
COP-5725 Practice Exercises
1 TRC vs DRC 한욱신. 2 Queries in TRC and DRC  TRC Q = {t| f(t)} where t is a (free) tuple variable and f(t) is a well-formed formula  DRC.
Relational Algebra Rohit Khokher. Relational Algebra Set Oriented Operations UnionIntersectionDifference Cartesian Product Relation Oriented Operations.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 SQL: Queries, Programming, Triggers Chapter 5 Modified by Donghui Zhang.
(Uses slides from Fernando Farfan and Eduardo J. Ruiz
INFS614, Fall 08 1 Relational Algebra Lecture 4. INFS614, Fall 08 2 Relational Query Languages v Query languages: Allow manipulation and retrieval of.
COP5725 – Principles of Database Management Systems
Exercise Exercise3.1 8 Exercise3.1 9 Exercise
Exercise Exercise Exercise Exercise
Exercise Exercise Exercise Exercise
Exercise Exercise6.1 7 Exercise6.1 8 Exercise6.1 9.
Relational Algebra Chapter 4 - part I. 2 Relational Query Languages  Query languages: Allow manipulation and retrieval of data from a database.  Relational.
Introduction to Database Systems 1 Relational Algebra Relational Model: Topic 3.
Rutgers University Relational Algebra 198:541 Rutgers University.
Relational Algebra Chapter 4 - part I. 2 Relational Query Languages  Query languages: Allow manipulation and retrieval of data from a database.  Relational.
CSCD343- Introduction to databases- A. Vaisman1 Relational Algebra.
Relational algebra SHIRAJ MOHAMED M | MIS 1. Relational algebra Notation SHIRAJ MOHAMED M | MIS 2.
Chapter 3 Introduction to SQL Yonsei University 1 st Semester, 2015 Sanghyun Park.
Review for Midterm. Problem 2.7 HasPriPhy Patients address name ssn age Doctors exp_year name ssn specialty Pharmacies name address phone PharmCo name.
$100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300.
Database Management Systems,1 Relational Calculus.
Oracle DML Dr. Bernard Chen Ph.D. University of Central Arkansas.
1 Relational Algebra Chapter 4, Sections 4.1 – 4.2.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 4 Relational Algebra.
CSCD34-Data Management Systems - A. Vaisman1 Relational Algebra.
COMP3030 Database Management System Final Review
CMPT 258 Database Systems Relational Algebra (Chapter 4)
1 Relational Algebra and SQL. 2 Relational Query Languages Languages for describing queries on a relational database Relational AlgebraRelational Algebra.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Basic SQL Queries.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts - 6 th Edition Chapter 8: Relational Algebra.
SQL Exercises. 1) Names of suppliers. Suppliers(sid, sname, address) Parts(pid, pname, color) Catalog(sid, pid, cost)
Database Systems (資料庫系統)
Module 2: Intro to Relational Model
Querying Relational Databases
Distributive Property
Relational Algebra - Part 1
Chapter 2: Intro to Relational Model
Relational Algebra Chapter 4 1.
CS 480: Database Systems Lecture 8 February 1, 2013.
Chapter 3: Intro to Relational Model
Chapter 2: Intro to Relational Model
Database Systems 10/13/2010 Lecture #4.
Question Which of the following plays an important role in representing information about the real world in a database? Explain briefly 1)DDL.
LECTURE 3: Relational Algebra
Relational Algebra Chapter 4 1.
Relational Algebra Chapter 4 - part I.
Relational Algebra : #I
Relational Algebra Chapter-2
Query Functions.
Chapter 2: Intro to Relational Model
Example of a Relation attributes (or columns) tuples (or rows)
Chapter 2: Intro to Relational Model
Chapter 2: Intro to Relational Model
실습 4주차.
Query Processing.
Relational Calculus Chapter 4, Part B 7/1/2019.
Relational Algebra Chapter 4 - part I.
Presentation transcript:

CH4 EXERCISES 4.2. Given two relations R1 and R2, where R1 contains N1 tuples, R2 contains N2 tuples, and N2 > N1 > 0, give the min and max possible sizes for the resulting relational algebra expressions: (1) R1UR2, (2) R1∩R2, (3) R1−R2, (4) R1×R2, (5) σa=5(R1), and (6) πa(R1) Sigma  Select rows Pi  Projection, extract columns UNION COMPATIBLE: Have same number of fields AND Have corresponding fields, taken in order from left to right, have the same domains.

CH4 EXERCISES 4.4. Consider the Supplier-Parts-Catalog schema from the previous question. State what the following queries compute: Find the Supplier names of the suppliers who supply a red part that costs less than 100 dollars. This Relational Algebra statement does not return anything than 100 dollars and a green part that costs less than 100 dollars. **Natural joins 3… because of the sequence of projection operators. Once the sid is projected, it is the only field in the set. Therefore, projecting on sname will not return anything.

CH4 EXERCISES 4.4. Consider the Supplier-Parts-Catalog schema from the previous question. State what the following queries compute: Find the Supplier ids of the suppliers who supply a red part that costs less than 100 dollars and a green part that costs less than 100 dollars. Find the Supplier names of the suppliers who supply a red part that costs less than 100 dollars and a green part that costs less than 100 dollars.

CH4 EXERCISES 4.6. What is relational completeness? If a query language is relationally complete, can you write any desired query in that language? Relational completeness means that a query language can express all the queries that can be expressed in relational algebra. It does not mean that the language can express any desired query.