{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

slides15 (1) - Schedule Today Feb 28(TH x x Datalog and SQL...

Info icon This preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Winter 2002 Arthur Keller – CS 180 15–1 Schedule Today: Feb. 28 (TH) Datalog and SQL Recursion, ODL. Read Sections 10.3-10.4, 4.1-4.4. Project Part 6 due. Mar. 5 (T) More ODL, OQL. Read Sections 9.1. Assignment 7 due. Mar. 7 (TH) More OQL. Read Sections 9.2-9.3. Mar. 12 (T) Semistructured Data, XML, XQuery. Read Sections 4.6-4.7. Assignment 8 due.
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Winter 2002 Arthur Keller – CS 180 15–2 SQL Recursion WITH stuff that looks like Datalog rules an SQL query about EDB, IDB Rule = [RECURSIVE] R (<arguments>) AS SQL query
Image of page 2
Winter 2002 Arthur Keller – CS 180 15–3 Example Find Sally’s cousins, using EDB Par(child, parent) . WITH Sib(x,y) AS SELECT p1.child, p2,child FROM Par p1, Par p2 WHERE p1.parent = p2.parent AND p1.child <> p2.child, RECURSIVE Cousin(x,y) AS Sib UNION (SELECT p1.child, p2.child FROM Par p1, Par p2, Cousin WHERE p1.parent = Cousin.x AND p2.parent = Cousin.y ) SELECT y FROM Cousin WHERE x = 'Sally';
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Winter 2002 Arthur Keller – CS 180 15–4 Plan for Describing Legal SQL Recursion 1. Define “monotonicity,” a property that generalizes “stratification.” 2. Generalize stratum graph to apply to SQL queries instead of Datalog rules. (Non)monotonicity replaces NOT in subgoals. 3. Define semantically correct SQL recursions in terms of stratum graph. Monotonicity If relation P is a function of relation Q (and perhaps other things), we say P is monotone in Q if adding tuples to Q cannot cause any tuple of P to be deleted.
Image of page 4
Winter 2002 Arthur Keller – CS 180 15–5 Monotonicity Example In addition to certain negations, an aggregation can cause nonmonotonicity. Sells(bar , beer , price) SELECT AVG(price) FROM Sells WHERE bar = 'Joe''s Bar'; Adding to Sells a tuple that gives a new beer Joe sells will usually change the average price of beer at Joe’s. Thus, the former result, which might be a single tuple like (2.78) becomes another single tuple like (2.81), and the old tuple is lost.
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Winter 2002 Arthur Keller – CS 180 15–6 Generalizing Stratum Graph to SQL Node for each relation defined by a “rule.” Node for each subquery in the “body” of a rule.
Image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern