SQL – underspecified (74)

Slides:



Advertisements
Similar presentations
Exercise 2 Relational Calculus
Advertisements

Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
The Relational Calculus
Database System - Assignment #3 Sept. 2012Yangjun Chen ACS Assignment #3 due Wed., Nov. 14, (30) Exercise 7.17 on Page 235 Show the result.
Copyright © 2004 Ramez Elmasri and Shamkant Navathe Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 15-1 Query Processing and.
Chapter 15 Algorithms for Query Processing and Optimization Copyright © 2004 Pearson Education, Inc.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
Basic Queries. 2 Retrieval Queries in SQL SQL has one basic statement for retrieving information from a database; the SELECT statement This is not the.
Database technology Lecture 2: Relational databases and SQL
Dept. of Computer & Information Sciences
1 DDL – subquery Sen Zhang. 2 Objectives What is a subquery? Learn how to create nested SQL queries Read sample scripts and book for different kinds of.
ACS-4902 Ron McFadyen Chapter 15 Algorithms for Query Processing and Optimization.
CS 104 Introduction to Computer Science and Graphics Problems Introduction to Database (2) Basic SQL 12/05/2008 Yang Song.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 6- 1.
관계 연산자 & SQL. Selection SELECT * FROM r WHERE A=B AND D>5.
Chapter 4 The Relational Algebra and Calculus Copyright © 2004 Ramez Elmasri and Shamkant Navathe.
FEN  Queries: SELECT  Data Manipulation: INSERT, UPDATE, DELETE SQL: Structured Query Language – Part 2.
1 CS 430 Database Theory Winter 2005 Lecture 12: SQL DML - SELECT.
SQL Chapters 4, 5 (ed. 7 Chaps. 6,7). SQL or SEQUEL (Structured English Query Language) Based on relational algebra First called ‘Square’ Developed in.
Relational Algebra - Chapter (7th ed )
CS 380 Introduction to Database Systems Chapter 7: The Relational Algebra and Relational Calculus.
Onsdag The concepts in a relation data model SQL DDL DML.
Retrieve the names of all employees in department 5 who work more than 10 hours per week on the ‘ProductX’ project. p10ssn ← (Π essn (σ hours > 10 (works-on.
603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 14 A First Course in Database Systems.
 Employee (fname, minit, lname, ssn, bdate, address, sex, salary, superssn, dno)  Department (dname, dnumber, mgrssn, mgrstartdate) 
Database Management Systems. NESTING OF QUERIES  Some queries require that existing values in the database be retrieved and then used in a comparison.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
1 CSE 480: Database Systems Lecture 12: SQL (Nested queries and Aggregate functions)
Structured Query Language (2) The main reference of this presentation is the textbook and PPT from : Elmasri & Navathe, Fundamental of Database Systems,
Copyright © 2004 Ramez Elmasri and Shamkant Navathe The Relational Calculus The main reference of this presentation is the textbook and PPT from : Elmasri.
Slide 6- 1 Additional Relational Operations Aggregate Functions and Grouping A type of request that cannot be expressed in the basic relational algebra.
Chapter 6 The Relational Algebra and Calculus Copyright © 2004 Ramez Elmasri and Shamkant Navathe.
Announcements Written Homework 1 due Nov 2 –See course web page –Exercises 5.12, 5.15, 6.17, 6.20, 6.22 (a,c,f only). Today –continue with SQL (chapter.
603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 11 A First Course in Database Systems.
COMP163 Database Management Systems September 18, 2008 Lecture 8 – Sections SQL Queries.
603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 20 A First Course in Database Systems.
603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 16 A First Course in Database Systems.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 The Relational Algebra and Relational Calculus.
1 COMP 1100 Basic SQL David J. Stucki. Outline SQL Overview Retrievals Schema creation Table creation Constraints Inserts Updates 2.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4 Basic SQL تنبيه : شرائح العرض (Slides) هي وسيلة لتوضيح الدرس واداة.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 Lecture # 10 July 10,2012 More SQL: Complex Queries, Triggers,
Relational Algebra. CENG 3512 Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database. Relational model supports.
CS580 Advanced Database Topics Chapter 8 SQL Irena Pevac.
Chapter 4 The Relational Algebra and Calculus
DQL Statements Lab - 3 COMP 353 Summer
Introduction to Relational Calculus Tuple Relational Calculus
CS580 Advanced Database Topics
6/22/2018.
Entity-Relationship Model Cont…..
The Relational Algebra and Relational Calculus
CS157B Query Optimization.
More SQL: Complex Queries, Triggers, Views, and Schema Modification
Elmasri/Navathe, Fundamentals of Database Systems, 4th Edition
376a. Database Design Dept. of Computer Science Vassar College
Joining Tables ضم الجداول وإستخراج مناظر views منها الهدف : 1- استخراج المعلومات من جدولين أو اكثر بالإستفادة من الرابط بينهما وبإستخدام SQL 2- شروط قواعد.
التحويل من نموذج الكيان ERD الى مخطط قواعد البيانات (نموذج علائقي)
Company Requirements.
لغة قواعد البيانات STRUCTURED QUERY LANGUAGE SQL))
Session - 6 Sequence - 2 SQL: The Structured Query Language:
LECTURE 3: Relational Algebra
Relational Algebra : #I
Relational Calculus and QBE
Introduction to Database Systems
More SQL: Complex Queries, Triggers, Views, and Schema Modification
Relational Calculus and QBE
1. Explain the following concepts: (a) superkey (b) key
SQL Updating Database Contents Presented by: Dr. Samir Tartir
SQLPLUS: Oracle SQL Interface
SQL Grouping, Ordering & Arithmetics Presented by: Dr. Samir Tartir
SQL: Set Operations & Nested Queries. Presented by: Dr. Samir Tartir
Presentation transcript:

SQL – underspecified (74) Domain Relational Calculus (59) SELECT lname, dname FROM Employee, Department WHERE sex = ‘M’ and dno = dnumber {<l,n>|  <l,f.s,x,d>  Employee (  <n,i,m>  Department ( ^ x = ‘M’ ^ d=i))} Tuple Relational Calculus (89) SQL - aliased (82) {t|  e  Employee (  d  Department ( t.lname = e.lname ^ t.dname = d.dname ^ e.sex = ‘M’ ^ e.dno = d.dnumber))} SELECT e.lname, d.dname FROM Employee e, Department d WHERE e.sex = ‘M’ and e.dno = d.dnumber Relational Algebra [in RC/SQL style] (71) e  Employee d  Department t  Π lname, dname (σ e.sex=‘M’ ^ e.dno = d.dnumber (e x d)) Π lname, dname (σ sex=‘M’ (Employee dno = dnumber Department)) Relational Algebra [in “native” (and underspecified) style] (64) English (82) Red = Existentialization Green = Projection Blue = Selection Gold = Join Color Meaning: List the last name and department number of all male employees.

(σ e.sex=‘M’ (e e.dno = d.dnumber d)) SQL – underspecified (74) Domain Relational Calculus (59) SELECT lname, dname FROM Employee, Department WHERE sex = ‘M’ and dno = dnumber {<l,n>|  <l,f.s,x,d>  Employee (  <n,i,m>  Department ( ^ x = ‘M’ ^ d=i))} Tuple Relational Calculus (89) SQL - aliased (82) {t|  e  Employee (  d  Department ( t.lname = e.lname ^ t.dname = d.dname ^ e.sex = ‘M’ ^ e.dno = d.dnumber))} SELECT e.lname, d.dname FROM Employee e, Department d WHERE e.sex = ‘M’ and e.dno = d.dnumber Relational Algebra [in RC/SQL style] (71) e  Employee d  Department t  Π lname, dname (σ e.sex=‘M’ ^ e.dno = d.dnumber (e x d)) (σ e.sex=‘M’ (σ e.dno = d.dnumber (e x d))) (σ e.sex=‘M’ (e e.dno = d.dnumber d)) e  Employee d  Department t  Π lname, dname (σ e.sex=‘M’ ^ e.dno = d.dnumber (e x d)) Π lname, dname (σ sex=‘M’ (Employee dno = dnumber Department)) Relational Algebra [in “native” (and underspecified) style] (64)

A  Π lname, dname (σ sex=‘M’ (Employee dno = dnumber Department)) Domain Relational Calculus (84) English (82) List the last name and department number of all male employees without dependents. {<l,n>|  <l,f.s,x,d>  Employee (  <n,i,m>  Department ( ^ x = ‘M’ ^ d=I ^~<p,a,g>Dependent(s=p)))} SQL - aliased (127) Tuple Relational Calculus (119) SELECT e.lname, d.dname FROM Employee e, Department d WHERE e.sex = ‘M’ and e.dno = d.dnumber and e.ssn not in (SELECT essn FROM Dependent) {t|  e  Employee (  d  Department ( t.lname = e.lname ^ t.dname = d.dname ^ e.sex = ‘M’ ^ e.dno = d.dnumber ^~cDependent(e.ssn=c.essn)))} Relational Algebra [in RC/SQL style] (109) e  Employee d  Department c  Dependent A  Π lname, dname,ssn (σ e.sex=‘M’ ^ e.dno = d.dnumber (e x d)) W  Π lname, dname,ssn A a.ssn = c.essn C T  Π lname, dname (A – W) A  Π lname, dname (σ sex=‘M’ (Employee dno = dnumber Department)) Relational Algebra [in “native” (and underspecified) style] (102)