Introduction to Data Management. Lecture #10 (Relational Calculus, Continued)
|
|
- Gladys Joseph
- 6 years ago
- Views:
Transcription
1 Introduction to Data Management Lecture #10 (Relational Calculus, Continued) Instructor: Mike Carey Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v Key deliverables and dates: HW #3: Last chance to turn it in! Midterm is next Tuesday (bring cheat-sheet) v Today s plan: Finish up relational calculus Take any review questions Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 2
2 Ex: Wisconsin Sailing Club Database Sailors Reserves Boats sid sname rating age sid bid date bid bname color 22 Dustin Brutus Lubber Andy Rusty Horatio Zorba Horatio Art Bob /10/ /10/ /8/ /7/ /10/ /6/ /12/ /5/ /8/ /8/ Interlake blue 102 Interlake red 103 Clipper green 104 Marine red Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 3 Tuple Relational Calculus v Query in TRC has the form: { t(a1,a2,...) P(t) } v Answer includes all possible tuples t with the specified schema that make formula P(t) true. v Formula is recursively defined, starting with simple atomic formulas and building up bigger formulas using logical connectives. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 4
3 Review: Find sailors with a rating > 7 v Simplest answer, if all Sailors attributes desired: { s s Sailors s.rating > 7 } v Also equivalent to a more general formulation: { t(sid, sname, rating, age) s Sailors ( t.sid = s.sid t.sname = s.sname t.rating=s.rating t.age = s.age s.rating > 7 ) } (Notice how each specifies the answer s schema and values.) Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 5 Ex: TRC Query Semantics Sailors sid sname rating age 22 Dustin Brutus Lubber sid bid date /10/98 bid bname color 101 Interlake blue sid sname rating age 32 Andy Rusty Horatio Dustin nid nname nvalue 71 Zorba Horatio Art Bob Pi sid sname rating age 58 Rusty Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 6
4 Review: Find ids of sailors who are older than 30.0 or who have a rating under 8 and are named Horatio { t(sid) s Sailors ( (s.age > 30.0 (s.rating < 8 s.sname = Horatio )) t.sid = s.sid ) } Again, how result schema and values are specified Use of Boolean formula to specify the query constraints Highly declarative nature of this form of query language! Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 7 Unsafe Queries and Expressive Power v It is possible to write syntactically correct calculus queries that have an infinite number of answers! Such queries are called unsafe. E.g., s s Sailors v It is known that every query that can be expressed in relational algebra can be expressed as a safe query in DRC / TRC; the converse is also true. v Relational Completeness: Query language (e.g., SQL) can express every query that is expressible in relational algebra/calculus. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 8
5 Find names of sailors who ve reserved a red boat { t(sname) s Sailors (t.sname = s.sname r Reserves (r.sid = s.sid b Boats (b.bid = r.bid b.color = red ))) } Again, how result schema and values are specified How joins appear here as value-matching predicates Highly declarative nature of this form of query language! Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 9 Find ids of sailors who ve reserved a red or a green boat { t(sid) s Sailors (t.sid = s.sid r Reserves (r.sid = s.sid b Boats (b.bid = r.bid (b.color = red b.color = green )))) } Just had to add a disjunctive test to the previous query! Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 10
6 Find ids of sailors who ve reserved a red and a green boat { t(sid) s Sailors (t.sid = s.sid r1 Reserves (r1.sid = s.sid b1 Boats (b1.bid = r1.bid b1.color = red )) r2 Reserves (r2.sid = s.sid b2 Boats (b2.bid = r2.bid b2.color = green )))} This required several more variables! (Q: Why?) Q: Could we have done this with just s, r, b1, and b2? (And why?) Think of tuple variables as fingers pointing at the tables rows Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 11 Example: Tuple Variable Bindings Sailors sid sname rating age 22 Dustin Brutus Lubber Andy Rusty Horatio Zorba (Bindings at one point in time J ) s Reserves sid bid date /10/ /10/ /8/ /7/98 Boats 74 Horatio /10/98 bid bname color 85 Art /6/ Interlake blue 95 Bob /12/ Interlake red /5/ Clipper green /8/ Marine red /8/93 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 12 r1 r2 b1 b2
7 Find the names of sailors who ve reserved all boats { t(sname) s Sailors (t.sname = s.sname b Boats ( r Reserves (r.sid = s.sid b.bid = r.bid) ) ) } How universal quantification addresses the all query use case Highly declarative nature of this form of query language! Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 13 Find the names of sailors who ve reserved all Interlake boats { t(sname) s Sailors (t.sname = s.sname b Boats (b.bname = Interlake ( r Reserves (r.sid = s.sid b.bid = r.bid) ) ) ) } v Or, if you prefer: { t(sname) s Sailors (t.sname = s.sname b Boats (b.bname Interlake ( r Reserves (r.sid = s.sid b.bid = r.bid) ) ) ) } Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 14
8 Relational Calculus Summary v Relational calculus is non-operational, and users define queries in terms of what they want, not in terms of how to compute it. (Declarativeness: What, not how! ) v Algebra and safe calculus subset have same expressive power, leading to the notion of relational completeness for query languages. v Two calculus variants: TRC (tuple relational calculus, which we ve studied) and DRC (domain relational calculus). Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 15 What Have We Learned So Far? v First we do conceptual modeling (E-R schema) eid name Employee salary mgr emp 1 N M pcttime WorksIn Manages budget v Then we develop a good logical schema (relational) Employee(eid, name, salary, mgrid) PK(eid), FK(mgrid) REFS Employee WorksIn(empid, deptid, pcttime) PK(empid, deptid), FK(empid) REFS Employee, FK(deptid) REFS Department Department(did, dname, budget) PK(did) Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 16 N did dname Department
9 What Have We Learned So Far? Employee(eid, name, salary, mgrid) WorksIn(empid, deptid, pcttime) Department(did, dname, budget) v We can double-check the schema using relational DB design theory (dependency theory & normal forms) v Queries are then written against the relational schema Relational algebra π eid, salary esal, msal ((σ salary > msal (Employee mgrid = mid (π eid mid, salary msal (Employee))) Tuple relational calculus { t(eid, esal, msal) e Employee (t.eid = e.eid t.esal = e.salary m Employee (t.msal = m.salary e.mgrid = m.eid e.salary > m.salary) )} Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 17 Questions Before We Proceed? v Lingering E-R questions? E.g., key cardinality and/or inheritance mapping? v FD/normalization questions? v Relational algebra questions? v Relational calculus questions? v Okay, then: You re ready for the Midterm Exam! (You may bring a 2-sided 8.5x11 cheat sheet.) Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 18
Introduction to Data Management. Lecture #13 (Relational Calculus, Continued) It s time for another installment of...
Introduction to Data Management Lecture #13 (Relational Calculus, Continued) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 It s time for another
More informationIntroduction to Data Management. Lecture #14 (Relational Languages IV)
Introduction to Data Management Lecture #14 (Relational Languages IV) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 It s time again for...
More informationRelational Calculus. Chapter Comp 521 Files and Databases Fall
Relational Calculus Chapter 4.3-4.5 Comp 521 Files and Databases Fall 2010 1 Relational Calculus Comes in two flavors: Tuple relational calculus (TRC) and Domain relational calculus (DRC). Calculus has
More informationIntroduction to Data Management. Lecture 14 (SQL: the Saga Continues...)
Introduction to Data Management Lecture 14 (SQL: the Saga Continues...) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v HW and
More informationRelational Calculus. Chapter Comp 521 Files and Databases Fall
Relational Calculus Chapter 4.3-4.5 Comp 521 Files and Databases Fall 2016 1 Relational Calculus Comes in two flavors: Tuple relational calculus (TRC) and Domain relational calculus (DRC). Calculus has
More informationBasic form of SQL Queries
SQL - 1 Week 6 Basic form of SQL Queries SELECT FROM WHERE target-list relation-list qualification target-list A list of attributes of output relations in relation-list relation-list A list of relation
More informationCS 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 informationDatabase Applications (15-415)
Database Applications (15-415) SQL-Part II Lecture 8, February 2, 2016 Mohammad Hammoud Today Last Session: Standard Query Language (SQL)- Part I Today s Session: Standard Query Language (SQL)- Part II
More informationMidterm Exam #2 (Version A) CS 122A Winter 2017
NAME: SEAT NO.: STUDENT ID: Midterm Exam #2 (Version A) CS 122A Winter 2017 Max. Points: 100 (Please read the instructions carefully) Instructions: - The total time for the exam is 50 minutes; be sure
More informationDatabase Applications (15-415)
Database Applications (15-415) Relational Algebra Lecture 5, January 24, 2016 Mohammad Hammoud Today Last Session: The relational model Today s Session: Relational algebra Relational query languages (in
More informationSQL Part 2. Kathleen Durant PhD Northeastern University CS3200 Lesson 6
SQL Part 2 Kathleen Durant PhD Northeastern University CS3200 Lesson 6 1 Outline for today More of the SELECT command Review of the SET operations Aggregator functions GROUP BY functionality JOIN construct
More informationDatabases - Relational Algebra. (GF Royle, N Spadaccini ) Databases - Relational Algebra 1 / 24
Databases - Relational Algebra (GF Royle, N Spadaccini 2006-2010) Databases - Relational Algebra 1 / 24 This lecture This lecture covers relational algebra which is the formal language underlying the manipulation
More informationThis lecture. Projection. Relational Algebra. Suppose we have a relation
This lecture Databases - Relational Algebra This lecture covers relational algebra which is the formal language underlying the manipulation of relations. We follow the notation from Chapter 4 of Ramakrishnan
More informationLecture 3 More SQL. Instructor: Sudeepa Roy. CompSci 516: Database Systems
CompSci 516 Database Systems Lecture 3 More SQL Instructor: Sudeepa Roy Duke CS, Fall 2018 CompSci 516: Database Systems 1 Announcements HW1 is published on Sakai: Resources -> HW -> HW1 folder Due on
More informationDatabase Management Systems. Chapter 5
Database Management Systems Chapter 5 SQL Example Instances We will use these instances of the Sailors and Reserves relations in our examples. If the key for the Reserves relation contained only the attributes
More informationRelational Algebra and Calculus. Relational Query Languages. Formal Relational Query Languages. Yanlei Diao UMass Amherst Feb 1, 2007
Relational Algebra and Calculus Yanlei Diao UMass Amherst Feb 1 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 Relational Query Languages A major strength of the relational model: supports simple
More informationExperimenting with bags (tables and query answers with duplicate rows):
January 16, 2013 Activities CS 386/586 Experimenting with bags (tables and query answers with duplicate rows): Write an SQL query (and run it against the sailors database) that does the following: 1. List
More informationIntroduction to Data Management. Lecture #11 (Relational Algebra)
Introduction to Data Management Lecture #11 (Relational Algebra) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v HW and exams:
More informationLecture 3 SQL - 2. Today s topic. Recap: Lecture 2. Basic SQL Query. Conceptual Evaluation Strategy 9/3/17. Instructor: Sudeepa Roy
CompSci 516 Data Intensive Computing Systems Lecture 3 SQL - 2 Instructor: Sudeepa Roy Announcements HW1 reminder: Due on 09/21 (Thurs), 11:55 pm, no late days Project proposal reminder: Due on 09/20 (Wed),
More informationLecture 2 SQL. Instructor: Sudeepa Roy. CompSci 516: Data Intensive Computing Systems
CompSci 516 Data Intensive Computing Systems Lecture 2 SQL Instructor: Sudeepa Roy Duke CS, Spring 2016 CompSci 516: Data Intensive Computing Systems 1 Announcement If you are enrolled to the class, but
More informationThis lecture. Step 1
This lecture Databases - Relational Algebra II This lecture continues queries in relational algebra. (GF Royle 2006-8, N Spadaccini 2008) Databases - Relational Algebra II 1 / 27 (GF Royle 2006-8, N Spadaccini
More informationSQL: Queries, Programming, Triggers
SQL: Queries, Programming, Triggers CSC343 Introduction to Databases - A. Vaisman 1 Example Instances We will use these instances of the Sailors and Reserves relations in our examples. If the key for the
More informationCompSci 516: Database Systems
CompSci 516 Database Systems Lecture 4 Relational Algebra and Relational Calculus Instructor: Sudeepa Roy Duke CS, Fall 2018 CompSci 516: Database Systems 1 Reminder: HW1 Announcements Sakai : Resources
More informationSQL: Queries, Constraints, Triggers
SQL: Queries, Constraints, Triggers [R&G] Chapter 5 CS4320 1 Example Instances We will use these instances of the Sailors and Reserves relations in our examples. If the key for the Reserves relation contained
More informationCIS 330: Applied Database Systems
1 CIS 330: Applied Database Systems Lecture 7: SQL Johannes Gehrke johannes@cs.cornell.edu http://www.cs.cornell.edu/johannes Logistics Office hours role call: Mondays, 3-4pm Tuesdays, 4:30-5:30 Wednesdays,
More informationThe Database Language SQL (i)
ICS 321 all 2013 he Database Language SQL (i) Asst. Prof. Lipyeow Lim Information & Computer Science Department niversity of Hawaii at Manoa 9/30/2013 Lipyeow Lim -- niversity of Hawaii at Manoa 1 Example
More informationSQL. Chapter 5 FROM WHERE
SQL Chapter 5 Instructor: Vladimir Zadorozhny vladimir@sis.pitt.edu Information Science Program School of Information Sciences, University of Pittsburgh 1 Basic SQL Query SELECT FROM WHERE [DISTINCT] target-list
More informationSQL: Queries, Programming, Triggers. Basic SQL Query. Conceptual Evaluation Strategy. Example of Conceptual Evaluation. A Note on Range Variables
SQL: Queries, Programming, Triggers Chapter 5 Database Management Systems, R. Ramakrishnan and J. Gehrke 1 R1 Example Instances We will use these instances of the Sailors and Reserves relations in our
More informationRelational 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 informationDatabase Systems ( 資料庫系統 )
Database Systems ( 資料庫系統 ) October /24, 200 Lecture #5 1 Intimate Computing Can digital technology express intimacy? as something that relates to our innermost selves, something personal, closely felt
More informationDatabase Applications (15-415)
Database Applications (15-415) SQL-Part I Lecture 7, January 31, 2016 Mohammad Hammoud Today Last Session: Relational Calculus & Summary Today s Session: Standard Query Language (SQL)- Part I Announcements:
More informationReview: Where have we been?
SQL Basic Review Query languages provide 2 key advantages: Less work for user asking query More opportunities for optimization Algebra and safe calculus are simple and powerful models for query languages
More informationDatabase Management Systems. Chapter 4. Relational Algebra. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1
Database Management Systems Chapter 4 Relational Algebra Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Formal Relational Query Languages Two mathematical Query Languages form the basis
More informationDatabase Systems. October 12, 2011 Lecture #5. Possessed Hands (U. of Tokyo)
Database Systems October 12, 2011 Lecture #5 1 Possessed Hands (U. of Tokyo) 2 1 Course Administration Assignment #2 will be out on the course homepage. It is due in two weeks (Oct. 26, 2011). Assignment
More informationRelational Algebra. Note: Slides are posted on the class website, protected by a password written on the board
Note: Slides are posted on the class website, protected by a password written on the board Reading: see class home page www.cs.umb.edu/cs630. Relational Algebra CS430/630 Lecture 2 Slides based on Database
More informationKeys, SQL, and Views CMPSCI 645
Keys, SQL, and Views CMPSCI 645 SQL Overview SQL Preliminaries Integrity constraints Query capabilities SELECT-FROM- WHERE blocks, Basic features, ordering, duplicates Set ops (union, intersect, except)
More informationv Conceptual Design: ER model v Logical Design: ER to relational model v Querying and manipulating data
Outline Conceptual Design: ER model Relational Algebra Calculus Yanlei Diao UMass Amherst Logical Design: ER to relational model Querying and manipulating data Practical language: SQL Declarative: say
More informationOverview of DB & IR. ICS 624 Spring Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa
ICS 624 Spring 2011 Overview of DB & IR Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 1/12/2011 Lipyeow Lim -- University of Hawaii at Manoa 1 Example
More informationIntroduction to Data Management. Lecture 16 (SQL: There s STILL More...) It s time for another installment of...
Introduction to Data Management Lecture 16 (SQL: There s STILL More...) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 It s time for another
More informationIntroduction to Data Management. Lecture #11 (Relational Languages I)
Introduction to Data Management Lecture #11 (Relational Languages I) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements Homework stuff
More informationRELATIONAL ALGEBRA AND CALCULUS
4 RELATIONAL ALGEBRA AND CALCULUS Stand firm in your refusal to remain conscious during algebra. In real life, I assure you, there is no such thing as algebra. Fran Lebowitz, Social Studies This chapter
More informationSQL: The Query Language Part 1. Relational Query Languages
SQL: The Query Language Part 1 CS 186, Fall 2002, Lecture 9 R &G - Chapter 5 Life is just a bowl of queries. -Anon (not Forrest Gump) Relational Query Languages A major strength of the relational model:
More informationPrinciples of Data Management. Lecture #9 (Query Processing Overview)
Principles of Data Management Lecture #9 (Query Processing Overview) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Today s Notable News v Midterm
More informationQUERIES, PROGRAMMING, TRIGGERS
5 SQL: QUERIES, PROGRAMMING, TRIGGERS What men or gods are these? What maidens loth? What mad pursuit? What struggle to escape? What pipes and timbrels? What wild ecstasy? What is the average salary in
More informationRelational Algebra. Chapter 4, Part A. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1
Relational Algebra Chapter 4, Part A Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database.
More informationData Science 100. Databases Part 2 (The SQL) Slides by: Joseph E. Gonzalez & Joseph Hellerstein,
Data Science 100 Databases Part 2 (The SQL) Slides by: Joseph E. Gonzalez & Joseph Hellerstein, jegonzal@berkeley.edu jhellerstein@berkeley.edu? Previously Database Management Systems A database management
More informationRelational Algebra. Relational Query Languages
Relational Algebra π CS 186 Fall 2002, Lecture 7 R & G, Chapter 4 By relieving the brain of all unnecessary work, a good notation sets it free to concentrate on more advanced problems, and, in effect,
More informationToday s topics. Null Values. Nulls and Views in SQL. Standard Boolean 2-valued logic 9/5/17. 2-valued logic does not work for nulls
Today s topics CompSci 516 Data Intensive Computing Systems Lecture 4 Relational Algebra and Relational Calculus Instructor: Sudeepa Roy Finish NULLs and Views in SQL from Lecture 3 Relational Algebra
More informationThe SQL Query Language. Creating Relations in SQL. Adding and Deleting Tuples. Destroying and Alterating Relations. Conceptual Evaluation Strategy
The SQ Query anguage Developed by IBM (system R) in the 1970s Need for a standard since it is used by many vendors Standards: SQ-86 SQ-89 (minor revision) SQ-92 (major revision, current standard) SQ-99
More informationPrinciples of Data Management. Lecture #12 (Query Optimization I)
Principles of Data Management Lecture #12 (Query Optimization I) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Today s Notable News v B+ tree
More informationSQL - Lecture 3 (Aggregation, etc.)
SQL - Lecture 3 (Aggregation, etc.) INFS 614 INFS614 1 Example Instances S1 S2 R1 sid bid day 22 101 10/10/96 58 103 11/12/96 sid sname rating age 22 dustin 7 45.0 31 lubber 8 55.5 58 rusty 10 35.0 sid
More informationRelational Query Languages. Preliminaries. Formal Relational Query Languages. Example Schema, with table contents. Relational Algebra
Note: Slides are posted on the class website, protected by a password written on the board Reading: see class home page www.cs.umb.edu/cs630. Relational Algebra CS430/630 Lecture 2 Relational Query Languages
More informationIntroduction to Data Management. Lecture #18 (SQL, the Final Chapter )
Introduction to Data Management Lecture #18 (SQL, the Final Chapter ) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v HW #6 is
More informationCompSci 516 Data Intensive Computing Systems
CompSci 516 Data Intensive Computing Systems Lecture 9 Join Algorithms and Query Optimizations Instructor: Sudeepa Roy CompSci 516: Data Intensive Computing Systems 1 Announcements Takeaway from Homework
More informationRelational Query Languages
1 ITCS 3160 DATA BASE DESIGN AND IMPLEMENTATION JING YANG 2010 FALL Class 9: The Relational Algebra and Relational Calculus Relational Query Languages 2 Query languages: Allow manipulation and retrieval
More informationRelational Algebra. [R&G] Chapter 4, Part A CS4320 1
Relational Algebra [R&G] Chapter 4, Part A CS4320 1 Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database. Relational model supports simple, powerful QLs:
More informationRelational Query Languages. Relational Algebra. Preliminaries. Formal Relational Query Languages. Relational Algebra: 5 Basic Operations
Relational Algebra R & G, Chapter 4 By relieving the brain of all unnecessary work, a good notation sets it free to concentrate on more advanced problems, and, in effect, increases the mental power of
More informationCAS CS 460/660 Introduction to Database Systems. Relational Algebra 1.1
CAS CS 460/660 Introduction to Database Systems Relational Algebra 1.1 Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database. Relational model supports simple,
More informationOperations 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 informationHW1 is due tonight HW2 groups are assigned. Outline today: - nested queries and witnesses - We start with a detailed example! - outer joins, nulls?
L05: SQL 183 Announcements! HW1 is due tonight HW2 groups are assigned Outline today: - nested queries and witnesses - We start with a detailed example! - outer joins, nulls? 184 Small IMDB schema (SQLite)
More informationSQL: Queries, Constraints, Triggers (iii)
ICS 321 Fall 2009 SQL: Queries, Constraints, Triggers (iii) Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 9/24/2009 Lipyeow Lim -- University of Hawaii
More informationOverview of the Class and Introduction to DB schemas and queries. Lois Delcambre
Overview of the Class and Introduction to DB schemas and queries Lois Delcambre 1 CS 386/586 Introduction to Databases Instructor: Lois Delcambre lmd@cs.pdx.edu 503 725-2405 TA: TBA Office Hours: Immediately
More informationData Science 100 Databases Part 2 (The SQL) Previously. How do you interact with a database? 2/22/18. Database Management Systems
Data Science 100 Databases Part 2 (The SQL) Slides by: Joseph E. Gonzalez & Joseph Hellerstein, jegonzal@berkeley.edu jhellerstein@berkeley.edu? Previously Database Management Systems A database management
More informationRelational Algebra 1
Relational Algebra 1 Relational Algebra Last time: started on Relational Algebra What your SQL queries are translated to for evaluation A formal query language based on operators Rel Rel Op Rel Op Rel
More informationMidterm Exam (Version B) CS 122A Spring 2017
NAME: SOLUTION SEAT NO.: STUDENT ID: Midterm Exam (Version B) CS 122A Spring 2017 Max. Points: 100 (Please read the instructions carefully) Instructions: - The total time for the exam is 80 minutes; be
More informationDatabase Systems. Course Administration. 10/13/2010 Lecture #4
Database Systems 10/13/2010 Lecture #4 1 Course Administration Assignment #1 is due at the end of next week s class. Course slides will now have black background Printer friendly: set the printing color
More informationRelational Algebra Homework 0 Due Tonight, 5pm! R & G, Chapter 4 Room Swap for Tuesday Discussion Section Homework 1 will be posted Tomorrow
Relational Algebra R & G, Chapter 4 By relieving the brain of all unnecessary work, a good notation sets it free to concentrate on more advanced problems, and, in effect, increases the mental power of
More informationRelational algebra. Iztok Savnik, FAMNIT. IDB, Algebra
Relational algebra Iztok Savnik, FAMNIT Slides & Textbook Textbook: Raghu Ramakrishnan, Johannes Gehrke, Database Management Systems, McGraw-Hill, 3 rd ed., 2007. Slides: From Cow Book : R.Ramakrishnan,
More informationCIS 330: Applied Database Systems. ER to Relational Relational Algebra
CIS 330: Applied Database Systems ER to Relational Relational Algebra 1 Logical DB Design: ER to Relational Entity sets to tables: ssn name Employees lot CREATE TABLE Employees (ssn CHAR(11), name CHAR(20),
More informationCSCC43H: Introduction to Databases. Lecture 3
CSCC43H: Introduction to Databases Lecture 3 Wael Aboulsaadat Acknowledgment: these slides are partially based on Prof. Garcia-Molina & Prof. Ullman slides accompanying the course s textbook. CSCC43: Introduction
More informationSQL: Queries, Programming, Triggers
SQL: Queries, Programming, Triggers Chapter 5 1 Introduction We now introduce SQL, the standard query language for relational DBS. Like relational algebra, an SQL query takes one or two input tables and
More informationLecture #8 (Still More Relational Theory...!)
Introduction to Data Management Lecture #8 (Still More Relational Theory...!) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v
More informationMIS Database Systems Relational Algebra
MIS 335 - Database Systems Relational Algebra http://www.mis.boun.edu.tr/durahim/ Ahmet Onur Durahim Learning Objectives Basics of Query Languages Relational Algebra Selection Projection Union, Intersection,
More informationIntroduction to Data Management. Lecture #17 (SQL, the Never Ending Story )
Introduction to Data Management Lecture #17 (SQL, the Never Ending Story ) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v HW
More informationIntroduction to Data Management. Lecture #4 (E-R Relational Translation)
Introduction to Data Management Lecture #4 (E-R Relational Translation) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v Today
More informationCSE 444: Database Internals. Section 4: Query Optimizer
CSE 444: Database Internals Section 4: Query Optimizer Plan for Today Problem 1A, 1B: Estimating cost of a plan You try to compute the cost for 5 mins We will go over the solution together Problem 2: Sellinger
More informationRelational Algebra. Study Chapter Comp 521 Files and Databases Fall
Relational Algebra Study Chapter 4.1-4.2 Comp 521 Files and Databases Fall 2010 1 Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database. Relational model
More informationEnterprise Database Systems
Enterprise Database Systems Technological Educational Institution of Larissa in collaboration with Staffordshire University Larissa 2006 Dr. Georgia Garani garani@teilar.gr Dr. Theodoros Mitakos teo_ms@yahoo.com
More informationCITS3240 Databases Mid-semester 2008
CITS3240 Databases Mid-semester 2008 This paper consists of 6 pages and 3 questions. You should complete every question (total of 40 marks). Answer each question in the space provided. Name: Student Number:
More informationRelational Algebra 1. Week 4
Relational Algebra 1 Week 4 Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database. Relational model supports simple, powerful QLs: Strong formal foundation
More informationIntroduction to Data Management. Lecture #7 (Relational Design Theory)
Introduction to Data Management Lecture #7 (Relational Design Theory) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v HW#2 is
More informationRelational Query Optimization. Highlights of System R Optimizer
Relational Query Optimization Chapter 15 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Highlights of System R Optimizer v Impact: Most widely used currently; works well for < 10 joins.
More informationIMPORTANT: Circle the last two letters of your class account:
Fall 2001 University of California, Berkeley College of Engineering Computer Science Division EECS Prof. Michael J. Franklin FINAL EXAM CS 186 Introduction to Database Systems NAME: STUDENT ID: IMPORTANT:
More informationAdvanced Database Management Systems
Advanced Database Management Systems Database Management Systems Alvaro A A Fernandes School of Computer Science, University of Manchester AAAF (School of CS, Manchester) Advanced DBMSs 2012-2013 1 / 144
More informationAdvanced Database Management Systems
Advanced Database Management Systems Database Management Systems Alvaro A A Fernandes School of Computer Science, University of Manchester AAAF (School of CS, Manchester) Advanced DBMSs 2012-2013 1 / 144
More informationEndterm Exam (Version B) CS 122A Spring 2017
NAME: SOLUTION SEAT NO.: STUDENT ID: Endterm Exam (Version B) CS 122A Spring 2017 Max. Points: 100 (Please read the instructions carefully) Instructions: - The total time for the exam is 120 minutes; be
More informationPrinciples of Data Management. Lecture #13 (Query Optimization II)
Principles of Data Management Lecture #13 (Query Optimization II) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Today s Notable News v Reminder:
More informationCSE 444: Database Internals. Sec2on 4: Query Op2mizer
CSE 444: Database Internals Sec2on 4: Query Op2mizer Plan for Today Problem 1A, 1B: Es2ma2ng cost of a plan You try to compute the cost for 5 mins We go over the solu2on together Problem 2: Sellinger Op2mizer
More informationQuery Optimization. Schema for Examples. Motivating Example. Similar to old schema; rname added for variations. Reserves: Sailors:
Query Optimization Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Schema for Examples (sid: integer, sname: string, rating: integer, age: real) (sid: integer, bid: integer, day: dates,
More informationIntroduction to Data Management. Lecture #4 (E-R à Relational Design)
Introduction to Data Management Lecture #4 (E-R à Relational Design) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v Reminders:
More information!-%/ -%& "-!&"!!!*0**
! It is not every question that deserves an answer. Publius Syrus. 42 B. C. "#$!"!%&"&! '%()** "!%+!!"#,%" "-+)**%! %!.!&,*!-%/ -%& "-!&"!!!*0**!"# $%&'()(*" #+,-'. /0$1-' #23)30 4. -'5.$ 1 6 SELECT (column_list)
More informationIntroduction to Data Management. Lecture 17 (SQL: There s STILL More...)
Introduction to Data Management Lecture 17 (SQL: There s STILL More...) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v HW s
More informationQuery Optimization. Schema for Examples. Motivating Example. Similar to old schema; rname added for variations. Reserves: Sailors:
Query Optimization atabase Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Schema for Examples (sid: integer, sname: string, rating: integer, age: real) (sid: integer, bid: integer, day: dates,
More informationDatabase Management System. Relational Algebra and operations
Database Management System Relational Algebra and operations Basic operations: Selection ( ) Selects a subset of rows from relation. Projection ( ) Deletes unwanted columns from relation. Cross-product
More informationOverview of Query Evaluation. Overview of Query Evaluation
Overview of Query Evaluation Chapter 12 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Overview of Query Evaluation v Plan: Tree of R.A. ops, with choice of alg for each op. Each operator
More informationEvaluation of Relational Operations. Relational Operations
Evaluation of Relational Operations Chapter 14, Part A (Joins) Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Relational Operations v We will consider how to implement: Selection ( )
More informationOverview of Query Processing
ICS 321 Fall 2013 Overview of Query Processing Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 11/20/2013 Lipyeow Lim -- University of Hawaii at Manoa 1
More informationLecture 2 SQL. Announcements. Recap: Lecture 1. Today s topic. Semi-structured Data and XML. XML: an overview 8/30/17. Instructor: Sudeepa Roy
Announcements CompSci 516 Data Intensive Computing Systems Lecture 2 SQL Instructor: Sudeepa Roy If you are enrolled to the class, but have not received the email from Piazza, please send me an email All
More informationOuter Join, More on SQL Constraints
Outer Join, More on SQL Constraints CS430/630 Lecture 10 Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke Outer Joins Include in join result non-matching tuples Result tuple
More informationWhy Study the Relational Model? The Relational Model. Relational Database: Definitions. The SQL Query Language. Relational Query Languages
Why Study the Relational Model? The Relational Model Most widely used model. Vendors: IBM, Informix, Microsoft, Oracle, Sybase, etc. Legacy systems in older models E.G., IBM s IMS Recent competitor: object-oriented
More information