Midterm Prep: OQL The mindset you should be in is object oriented. A number of you based on emails/queries I have been answering are still in the relational.

Slides:



Advertisements
Similar presentations
SQL: The Query Language Part 2
Advertisements

Query Optimization CS634 Lecture 12, Mar 12, 2014 Slides based on “Database Management Systems” 3 rd ed, Ramakrishnan and Gehrke.
 Database is SQL1.mdb ◦ import using MySQL Migration Toolkit 
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Relational Algebra Chapter 4, Part A Modified by Donghui Zhang.
INFS614, Fall 08 1 Relational Algebra Lecture 4. INFS614, Fall 08 2 Relational Query Languages v Query languages: Allow manipulation and retrieval of.
1 Relational Algebra & Calculus. 2 Relational Query Languages  Query languages: Allow manipulation and retrieval of data from a database.  Relational.
Algebra Problems… Solutions Algebra Problems… Solutions © 2007 Herbert I. Gross Set 4 By Herb I. Gross and Richard A. Medeiros next.
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.
Instructor: Craig Duckett CASE, ORDER BY, GROUP BY, HAVING, Subqueries
Dimensional Modeling CS 543 – Data Warehousing. CS Data Warehousing (Sp ) - Asim LUMS2 From Requirements to Data Models.
1 SQL: Structured Query Language (‘Sequel’) Chapter 5.
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.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Relational Algebra Chapter 4, Part A.
The University of Akron Dept of Business Technology Computer Information Systems Database Management Approaches 2440: 180 Database Concepts Instructor:
Solving Linear Equations
1 Relational Algebra and Calculus Yanlei Diao UMass Amherst Feb 1, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
Rutgers University Relational Algebra 198:541 Rutgers University.
Ch 2.5 – Multiplication of Real Numbers
3-6 Compound Inequalities
Introduction Solving inequalities is similar to solving equations. To find the solution to an inequality, use methods similar to those used in solving.
The Importance of Knowing Your Learning Style Knowing the best way(s) that you learn will help you to determine the study strategies that will work best.
Midterm 1 Concepts Relational Algebra (DB4) SQL Querying and updating (DB5) Constraints and Triggers (DB11) Unified Modeling Language (DB9) Relational.
Chapter 3: Equations and Inequations This chapter begins on page 126.
Subqueries. So far when data has been filtered the filter has been known and simply added to the Where clause but often you don’t know what the filter.
3 DIFFERENTIATION RULES.
Review “Query Languages” Algebra, Calculus, and SQL.
1 Relational Algebra and Calculus Chapter 4. 2 Relational Query Languages  Query languages: Allow manipulation and retrieval of data from a database.
The Relational Model: Relational Calculus
POSITION & ORIENTATION ANALYSIS. This lecture continues the discussion on a body that cannot be treated as a single particle but as a combination of a.
1 Single Table Queries. 2 Objectives  SELECT, WHERE  AND / OR / NOT conditions  Computed columns  LIKE, IN, BETWEEN operators  ORDER BY, GROUP BY,
th grade math Area of Triangles. Objective To find the area of triangles Why? To know how to use formulas and evaluate variable expressions using.
Pegasus Lectures, Inc. COPYRIGHT 2006 Volume I Companion Presentation Frank R. Miele Pegasus Lectures, Inc. Ultrasound Physics & Instrumentation 4 th Edition.
1 Relational Algebra. 2 Relational Query Languages v Query languages: Allow manipulation and retrieval of data from a database. v Relational model supports.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Relational Algebra.
1 Relational Algebra & Calculus Chapter 4, Part A (Relational Algebra)
1 Relational Algebra and Calculas Chapter 4, Part A.
Relational Algebra.
ICS 321 Fall 2011 The Relational Model of Data (i) Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 8/29/20111Lipyeow.
1 Theory, Practice & Methodology of Relational Database Design and Programming Copyright © Ellis Cohen Subqueries These slides are licensed under.
Learning Objectives At the end of this section you should be able to
Alternative Algorithms for Addition and Subtraction If we don’t teach them the standard way, how will they learn to compute?
 In this packet we will look at:  The meaning of acceleration  How acceleration is related to velocity and time  2 distinct types acceleration  A.
Lecture 7: Foundations of Query Languages Tuesday, January 23, 2001.
 5-9 Complex Numbers Objective: Students will be able to add, subtract, multiply, and divide complex numbers.
Relational Algebra p BIT DBMS II.
10-4 Solving Quadratic Equations by Using the Quadratic Formula Objectives Students will be able to: 1)Solve quadratic equations by using the Quadratic.
Relational Databases. SQL Sub-queries: queries within queries  So far when data has been filtered the filter has been known and simply added to the Where.
Revision on Matrices Finding the order of, Addition, Subtraction and the Inverse of Matices.
Problems With Assistance Module 3 – Problem 3 Filename: PWA_Mod03_Prob03.ppt This problem is adapted from: Exam #2 – Problem #1 – ECE 2300 – July 25,
The material in this lecture should be review. If you have not seen it before, you should be able to learn it quickly – and on your own. So we are going.
Relational Calculus Database Management Systems, 3rd ed., Ramakrishnan and Gehrke, Chapter 4.
Relational Algebra & Calculus
Tuning Transact-SQL Queries
Relational Algebra Chapter 4 1.
Relational Algebra Chapter 4, Part A
Relational Algebra.
February 7th – Exam Review
Relational Algebra 1.
Enhance BI Applications and Simplify Development
Relational Algebra Chapter 4 1.
Relational Algebra Chapter 4, Sections 4.1 – 4.2
Area What is the area of these shapes 8 x x2 x x 8x x x 8.
What is an equation? An equation is a mathematical statement that two expressions are equal. For example, = 7 is an equation. Note: An equation.
Chapter 5 Quadratics: Make connections between different representations of the quadratic function. You will also solve the quadratic equation using.
Introduction Solving inequalities is similar to solving equations. To find the solution to an inequality, use methods similar to those used in solving.
SQL: Structured Query Language
Multiplying and Dividing Rational Expressions
CENG 351 File Structures and Data Managemnet
Relational Algebra & Calculus
Relational Algebra Chapter 4 - part I.
Presentation transcript:

Midterm Prep: OQL The mindset you should be in is object oriented. A number of you based on s/queries I have been answering are still in the relational mindset – E.g. there is no real concept of a cross product in OQL (we deal with collections or bags) – You want to leverage the strengths of OQL – use the functions (appropriately).

Lets look at an example select distinct struct(star1: s1, star2: s2) from s1 in Stars, s2 in Stars where s1.addr = s2.addr and s1.name < s2.name; Note here s1 and s2 are collections – we are going to compare collections. Do not think of this as a cross product/join – the underlying OO system. I want you to in the exam when asked OQL queries to think object oriented. – Use functions!

Simple Query with Rename Give the names of people who are older than 26 years old: SELECT SName: p.name FROM p in People WHERE p.age > 26

Watch out for Path expressions Find the names of the students of all tutors: – SELECT t.students.name FROM t in Tutors – Illegal use of. Above Correct solution – SELECT s.name FROM t in Tutors, s in t.students Alternate notation – SELECT s.name FROM Tutors t, t.students s

Express the query in English Subquery in FROM clause What is this query trying to do? SELECT r.name FROM ( SELECT t FROM Tutors t WHERE t.salary > 300 ) r, r.students s WHERE st IN s AND st.fee > 30 In some implementations the IN is implicit: SELECT t.name FROM ( SELECT t FROM Tutors t WHERE t.salary > 300 ) r, r.students s WHERE s.fee > 30 Ans: Find the names of all tutors who have a salary greater than 300 and who have at least one student paying more than 30.

What do these do? SELECT t.name FROM t in TAs WHERE t.salary = max ( select ta.salary from ta in TAs ) Give the names of TAs with the highest salary SELECT sname, avgFee: AVG(SELECT p.s.fee FROM partition p) FROM t in Tutors, t.students s GROUP BY sname: s.name Give the names of the students and the average fee they pay their Tutors

Using subqueries in the Where clause Give the names of people who are not Tas – Assume PEOPLE class and TA class – You can solve this without assuming any connections between them. SELECT p.name FROM p in People WHERE not ( p.name in SELECT t.name FROM t in TAs ) Views can be used to simplify these things – you are free to use them unless the question explicitly asks you not too.

Rest of the exam Data Warehousing/Data Mining – Understand the defintions of support and confidence Given a transactional dtabase be able to determine these values for given rules – Understand at a basic level what pivoting, selecting, drill down and roll up imply Be able to manipulate tables such as the examples in the notes. – Conceptual questions Why is sparse matrix management important in data warehouses? What distinguishes them from traditional OLTP?

Object Relational Brush up on simple declarations as discussed in the notes Make sure you understand the difference between a row_type and an ADT Be able to manipulate simple queries Be able to instantiate simple functions Conceptually these are examples of things you may be asked. – Differences between object relational and OODB and pure relational – What does the ADT bring to the table. – Role of less than and equals functions and why they are important

Relational SQL Be able to solve simple and complicated queries – Pay particular attention to exists, not exists and mathematical logic operations (pg 207) – Pay attention to later stuff (e.g. recursive operations) Conceptual stuff (these are examples) – What is the difference between, relational, object relational and OQL across different dimensions? Querying Performance DISCLAIMER: All of these are just examples of things that could be asked on the midterm. You are responsible for everything covered in the notes and in the associated reading material.