Website/slides/cse4562sp2018/2018-02-05-RA-Basics.html

638 lines
28 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSE 4/562 - Spring 2018</title>
<meta name="description" content="CSE 4/562 - Spring 2018">
<meta name="author" content="Oliver Kennedy">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="../reveal.js-3.6.0/css/reveal.css">
<link rel="stylesheet" href="ubodin.css" id="theme">
<!-- Code syntax highlighting -->
<link rel="stylesheet" href="../reveal.js-3.6.0/lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? '../reveal.js-3.6.0/css/print/pdf.css' : '../reveal.js-3.6.0/css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<script src="../reveal.js-3.6.0/lib/js/head.min.js"></script>
<!--[if lt IE 9]>
<script src="../reveal.js-3.6.0/lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="header">
<!-- Any Talk-Specific Header Content Goes Here -->
CSE 4/562 - Database Systems
</div>
<div class="slides">
<section>
<h1>Relational Algebra</h1>
<h3>CSE 4/562 Database Systems</h3>
<h5>February 5, 2018</h5>
</section>
<section>
<section>
<h3>The running theme...</h3>
<p>
Replace <b>[Thing A]</b> with <u>better</u>, but <u>equivalent</u> <b>[Thing B]</b>.
<ol>
<li class="fragment">How can we tell if <b>[Thing B]</b> is equivalent to <b>[Thing A]</b>?</li>
<li class="fragment">How can we tell if <b>[Thing B]</b> is better than <b>[Thing A]</b>?</li>
</ol>
</p>
</section>
<section>
<p>
Replace <b>[Query A]</b> with <u>better</u>, but <u>equivalent</u> <b>[Query B]</b>.
<ol>
<li>How can we tell if <b>[Query B]</b> is equivalent to <b>[Query A]</b>?</li>
<li>How can we tell if <b>[Query B]</b> is better than <b>[Query A]</b>?</li>
</ol>
</p>
<p class="fragment">... but first a few definitions.</p>
</section>
<section>
<h3>Relational Data</h3>
<dl>
<dt>Relation (Table)</dt>
<dd>A collection of Tuples of Values</dd>
<dd>All tuples have the same set of attributes, or schema</dd>
</dl>
</section>
<section>
<h3>Relational Data</h3>
Types of relations...
<table><tr>
<td class="fragment">
<h4>Set</h4>
<table style="font-size: small;">
<tr><th>SPC_COMMON</th><th>BORONAME</th></tr>
<tr><td>'honeylocust'</td><td>'Brooklyn'</td></tr>
<tr><td>'American linden'</td><td>'Brooklyn'</td></tr>
<tr><td>'London planetree'</td><td>'Brooklyn'</td></tr>
<tr><td>&nbsp;</td><td>&nbsp;</td></tr>
<tr><td>&nbsp;</td><td>&nbsp;</td></tr>
</table>
<p style="font-size: 60%;">(Unique Only)</p>
</td>
<td>
<h4>Bag</h4>
<table style="font-size: small;">
<tr><th>SPC_COMMON</th><th>BORONAME</th></tr>
<tr><td>'honeylocust'</td><td>'Brooklyn'</td></tr>
<tr><td>'London planetree'</td><td>'Brooklyn'</td></tr>
<tr><td>'American linden'</td><td>'Brooklyn'</td></tr>
<tr><td>'London planetree'</td><td>'Brooklyn'</td></tr>
<tr><td>'honeylocust'</td><td>'Brooklyn'</td></tr>
</table>
</td>
<td class="fragment">
<h4>List</h4>
<table style="font-size: small;">
<tr><th>SPC_COMMON</th><th>BORONAME</th></tr>
<tr><td>'American linden'</td><td>'Brooklyn'</td></tr>
<tr><td>'honeylocust'</td><td>'Brooklyn'</td></tr>
<tr><td>'honeylocust'</td><td>'Brooklyn'</td></tr>
<tr><td>'London planetree'</td><td>'Brooklyn'</td></tr>
<tr><td>'London planetree'</td><td>'Brooklyn'</td></tr>
</table>
<p style="font-size: 60%;">(Order Matters)</p>
</td>
</tr></table>
</table>
</section>
<section>
<h3>Declarative Languages</h3>
<table>
<tr><th>Declarative</th><th>Imperative</th></tr>
<tr>
<td>Say <b>what</b> you want</td>
<td>Say <b>how</b> you want to get it</td>
</tr>
<tr>
<td style="vertical-align: middle;">"Get me the TPS Reports"</td>
<td>
<pre><code>Look at every T report
For each week:
Sum up the sprocket count
Find that week's S report
... </code></pre>
</td>
</tr>
<tr>
<td>SQL, RA, R, …</td>
<td>C, Scala, Java, Python, …</td>
</tr>
</table>
</section>
<section>
<p style="width: 600px; margin-left: auto; margin-right: auto;">Declarative languages make it easier to explore <u>equivalent</u> computations to find the <u>best</u> one.</p>
</section>
</section>
<section>
<section>
<h3>Declarative Queries</h3>
<dl>
<dt>SQL</dt>
<dd>Readability: Focus on what and where from</dd>
<dt>Relational Algebra</dt>
<dd>Data Flow: Focus on transformations</dd>
<dt>Relational Calculus</dt>
<dd>Minimality: Focus on attribute relationships</dd>
</dl>
</section>
<section>
<h3>SQL</h3>
<pre><code class="sql">
SELECT R.A FROM R, S
WHERE R.B = S.B AND S.C = 10
</code></pre>
</section>
<section>
<h3>Relational Algebra</h3>
<img src="graphics/2018-02-05-RA-Tree.svg" />
$$\pi_{R.A}(\sigma_{S.C=10}(\bowtie_{R.B = S.B}(\textbf{R}, \textbf{S})))$$
</section>
<section>
<h3>Relational Calculus</h3>
<p style="margin-top: 100px">
$$\exists B : R(A, B), S(B, 10)$$
</p>
</section>
<section>
<h3>Declarative Queries</h3>
<dl>
<dt class="fragment highlight-grey" data-fragment-index="1">SQL</dt>
<dd class="fragment highlight-grey" data-fragment-index="1">Readability: Focus on what and where from</dd>
<dt>Relational Algebra</dt>
<dd>Data Flow: Focus on transformations</dd>
<dt class="fragment highlight-grey" data-fragment-index="1">Relational Calculus</dt>
<dd class="fragment highlight-grey" data-fragment-index="1">Minimality: Focus on attribute relationships</dd>
</dl>
</section>
</section>
<section>
<section>
<h3 style="margin-bottom: 50px;">Preliminaries</h3>
<p>We start with a database <b>instance</b> with a fixed <b>schema</b></p>
<p class="fragment" style="margin-top: 40px;">
Queries are applied to Relations
$$Q(\textbf{Trees}, \textbf{SpeciesInfo})$$
</p>
<p class="fragment" style="margin-top: 40px;">
Queries are also Relations!
$$Q_2(\textbf{SpeciesInfo}, Q_1(\textbf{Trees}))$$
<span class="fragment" style="font-size: 50%; display: block; margin-top: 0px; margin-bottom: 10px;">(Relational Algebra is <u>Closed</u>)</span>
</p>
</section>
<section>
<h3>Relational Algebra</h3>
<table>
<tr><th>Operation</th><th>Sym</th><th>Meaning</th></tr>
<tr><td>Selection</td><td>$\sigma$</td><td>Select a subset of the input rows</td></tr>
<tr><td>Projection</td><td>$\pi$</td><td>Delete unwanted columns</td></tr>
<tr><td>Cross-product</td><td>$\times$</td><td>Combine two relations</td></tr>
<tr><td>Set-difference</td><td>$-$</td><td>Tuples in Rel 1, but not Rel 2</td></tr>
<tr><td>Union</td><td>$\cup$</td><td>Tuples either in Rel 1 or in Rel 2</td></tr>
</table>
<p class="fragment">
<b>Also:</b> Intersection, <u>Join</u>, Division, Renaming
</p>
<p class="fragment" style="font-size: 50%">(Not essential, but can be useful)</p>
</section>
<section>
<table>
<tr>
<th>Input</th>
<th></th>
<th>Query Language</th>
<th></th>
<th>Output</th>
</tr>
<tr class="fragment" data-fragment-index="1">
<td>Sets of Tuples</td>
<td>$\rightarrow$</td>
<td><span class="fragment highlight-grey" data-fragment-index="2">Set</span> Relational Algebra</td>
<td>$\rightarrow$</td>
<td>Set of Tuples</td>
</tr>
<tr class="fragment" data-fragment-index="3">
<td>Bags of Tuples</td>
<td>$\rightarrow$</td>
<td>Bag Relational Algebra</td>
<td>$\rightarrow$</td>
<td>Bag of Tuples</td>
</tr>
<tr class="fragment" data-fragment-index="4">
<td class="fragment highlight-grey" data-fragment-index="5">Lists of Tuples</td>
<td class="fragment highlight-grey" data-fragment-index="5">$\rightarrow$</td>
<td class="fragment highlight-grey" data-fragment-index="5">Extended Relational Algebra</td>
<td class="fragment highlight-grey" data-fragment-index="5">$\rightarrow$</td>
<td class="fragment highlight-grey" data-fragment-index="5">List of Tuples</td>
</tr>
</table>
<p class="fragment" data-fragment-index="5">First we focus on sets and bags.</p>
</section>
<section>
<h3>Selection ($\sigma_{c}$)</h3>
<p>Delete rows that fail the condition $c$.</p>
<div class="fragment">
$$\sigma_{(BORONAME = \texttt{'Brooklyn'})} \textbf{Trees}$$
<table style="font-size: small; margin-top: 30px;">
<tr><th>TREE_ID</th><th>SPC_COMMON</th><th>BORONAME</th><th>...</th></tr>
<tr><td>204026</td><td>'honeylocust'</td><td>'Brooklyn'</td><td>...</td></tr>
<tr><td>204337</td><td>'honeylocust'</td><td>'Brooklyn'</td><td>...</td></tr>
<tr><td>189565</td><td>'American linden'</td><td>'Brooklyn'</td><td>...</td></tr>
<tr><td>192755</td><td>'London planetree'</td><td>'Brooklyn'</td><td>...</td></tr>
<tr><td>189465</td><td>'London planetree'</td><td>'Brooklyn'</td><td>...</td></tr>
<tr><td style="font-weight: bold;" colspan="4">... and 177287 more</td></tr>
</table>
</div>
</section>
<section>
<h3>Projection ($\pi_{A}$)</h3>
<p>Delete attributes not in the projection list $A$.</p>
<div class="fragment">
$$\pi_{BORONAME}(Trees)$$
<table style="font-size: small; margin-top: 30px;">
<tr><th>BORONAME</th></tr>
<tr><td>Queens</td></tr>
<tr><td>Brooklyn</td></tr>
<tr><td>Manhattan</td></tr>
<tr><td>Bronx</td></tr>
<tr><td>Staten Island</td></tr>
</table>
</div>
<p class="fragment">Only 5 results... not 683788?</p>
<p class="fragment">Set and Bag Projection are different</p>
</section>
<section>
<h3>Reminder: Queries are Relations</h3>
<p>What are these queries schemas?</p>
<div class="fragment" style="margin-top: 50px;">$$\pi_{TREEID, SPC\_COMMON, BORONAME} \textbf{Trees}$$</div>
<div class="fragment" style="margin-top: 50px;">$$\sigma_{(BORONAME = \texttt{'Brooklyn'})} \textbf{Trees}$$</div>
<div class="fragment" style="margin-top: 50px;">$$\sigma_{(BORONAME = \texttt{'Brooklyn'})}(\pi_{TREEID, SPC\_COMMON, BORONAME} \textbf{Trees})$$</div>
</section>
<section>
<h3>Union ($\cup$)</h3>
<p style="margin-bottom: 0px;">Takes two relations that are <u>union-compatible</u>...</p>
<p style="font-size: 60%; margin-top: 0px;">(Both relations have the same number of fields with the same types)</p>
<p>... and returns all tuples appearing in <u>either</u> relation</p>
<div class="fragment" style="font-size: 70%;">
$$(\sigma_{(BORONAME=\texttt{'Brooklyn'})} \textbf{Trees}) \cup (\sigma_{(BORONAME=\texttt{'Manhattan'})} \textbf{Trees})$$
</div>
<p class="fragment">We use $\uplus$ if we explicitly mean <i>bag</i> union</p>
</section>
<section>
<h3>Intersection ($\cap$)</h3>
<p>Return all tuples appearing in <u>both</u> <br/>of two union-compatible relations</p>
<div class="fragment" style="font-size: 70%;">
$$(\sigma_{(BORONAME=\texttt{'Brooklyn'})} (\pi_{SPC\_COMMON} \textbf{Trees})) \\ ~~~~~~~~~\cap (\sigma_{(BORONAME=\texttt{'Manhattan'})} (\pi_{SPC\_COMMON} \textbf{Trees}))$$
<p>What is this query asking?</p>
</div>
</section>
<section>
<h3>Set Difference</h3>
<p>Return all tuples appearing in the first, but not the second<br/>of two union-compatible relations</p>
<div class="fragment" style="font-size: 70%;">
$$(\sigma_{(BORONAME=\texttt{'Brooklyn'})} (\pi_{SPC\_COMMON} \textbf{Trees})) \\ ~~~~~~~~~- (\sigma_{(BORONAME=\texttt{'Manhattan'})} (\pi_{SPC\_COMMON} \textbf{Trees}))$$
<p>What is this query asking?</p>
</div>
</section>
<section>
<h3>Union, Intersection, Set Difference</h3>
<p style="margin-top: 100px;">What is the schema of the result of any of these operators?</p>
</section>
<section>
<h3>Cross (Cartesian) Product ($\times$)</h3>
<p>Create all pairs of tuples.</p>
<div class="fragment" data-fragment-index="1">
<div style="font-size: 70%">
$$\pi_{SPC\_COMMON, BORONAME} (\textbf{Trees}) \times \pi_{SPC\_COMMON, AVG\_HEIGHT} (\textbf{TreeInfo})$$
</div>
<table style="font-size: small; margin-top: 30px; display: inline-block; vertical-align: middle; margin-right: 50px;">
<tr><th>SPC_COMMON</th><th>AVG_HEIGHT</th></tr>
<tr class="fragment highlight-current-blue" data-fragment-index="2"><td>cedar elm</td><td>60</td></tr>
<tr class="fragment highlight-current-blue" data-fragment-index="3"><td>lacebark elm</td><td>45</td></tr>
<tr><td colspan="2" style="font-weight: bold;">... and more</td></tr>
</table>
<table style="font-size: small; margin-top: 30px; display: inline-block; vertical-align: middle;">
<tr><th>SPC_COMMON</th><th>BORONAME</th><th>SPC_COMMON</th><th>AVG_HEIGHT</th></tr>
<tr class="fragment highlight-current-grey" data-fragment-index="3"><td>honeylocust</td><td>Brooklyn</td><td class="fragment highlight-current-blue" data-fragment-index="2">cedar elm</td><td>60</td></tr>
<tr class="fragment highlight-current-grey" data-fragment-index="3"><td>honeylocust</td><td>Brooklyn</td><td class="fragment highlight-current-blue" data-fragment-index="2">cedar elm</td><td>60</td></tr>
<tr class="fragment highlight-current-grey" data-fragment-index="3"><td>American linden</td><td>Brooklyn</td><td class="fragment highlight-current-blue" data-fragment-index="2">cedar elm</td><td>60</td></tr>
<tr class="fragment highlight-current-grey" data-fragment-index="3"><td>London planetree</td><td>Manhattan</td><td class="fragment highlight-current-blue" data-fragment-index="2">cedar elm</td><td>60</td></tr>
<tr class="fragment highlight-current-grey" data-fragment-index="3"><td>London planetree</td><td>Manhattan</td><td class="fragment highlight-current-blue" data-fragment-index="2">cedar elm</td><td>60</td></tr>
<tr><td style="font-weight: bold;" colspan="4">...</td></tr>
<tr class="fragment highlight-current-grey" data-fragment-index="2"><td>honeylocust</td><td>Brooklyn</td><td class="fragment highlight-current-blue" data-fragment-index="3">lacebark elm</td><td>45</td></tr>
<tr class="fragment highlight-current-grey" data-fragment-index="2"><td>honeylocust</td><td>Brooklyn</td><td class="fragment highlight-current-blue" data-fragment-index="3">lacebark elm</td><td>45</td></tr>
<tr class="fragment highlight-current-grey" data-fragment-index="2"><td>American linden</td><td>Brooklyn</td><td class="fragment highlight-current-blue" data-fragment-index="3">lacebark elm</td><td>45</td></tr>
<tr class="fragment highlight-current-grey" data-fragment-index="2"><td>London planetree</td><td>Manhattan</td><td class="fragment highlight-current-blue" data-fragment-index="3">lacebark elm</td><td>45</td></tr>
<tr class="fragment highlight-current-grey" data-fragment-index="2"><td>London planetree</td><td>Manhattan</td><td class="fragment highlight-current-blue" data-fragment-index="3">lacebark elm</td><td>45</td></tr>
<tr><td style="font-weight: bold;" colspan="4">... and more</td></tr>
</table>
</div>
</section>
<section>
<h3>Cross (Cartesian) Product ($\times$)</h3>
<div style="font-size: 70%; margin-top: 50px;">
$$\pi_{SPC\_COMMON,\ BORONAME} (\textbf{Trees}) \times \pi_{SPC\_COMMON,\ AVG\_HEIGHT} (\textbf{TreeInfo})$$
</div>
<p style="margin-top: 50px;">What is the schema of the resulting relation?</p>
<p class="fragment">The relation has a naming conflict<br/>(two attributes with the same name)</p>
</section>
<section>
<h3>Renaming ($\rho$)</h3>
<div style="font-size: 50%; margin-top: 50px;">
$$\rho_{TNAME,\ BORO,\ INAME,\ HEIGHT}\left( \pi_{SPC\_COMMON,\ BORONAME} (\textbf{Trees}) \times \pi_{SPC\_COMMON,\ AVG\_HEIGHT} (\textbf{TreeInfo})\right)$$
</div>
<p style="margin-top: 50px;">What is the schema of the resulting relation?</p>
<p style="margin-top: 50px;" class="fragment">When writing cross-products on the board,<br/>I will use implicit renaming</p>
</section>
<section>
<h3>Join ($\bowtie_c$)</h3>
<p>Pair tuples according to a condition c.</p>
<div style="font-size: 50%; margin-top: 50px;">
$$\pi_{SPC\_COMMON,\ BORONAME} (\textbf{Trees}) \bowtie_{T.SPC\_COMMON = TI.SPC\_COMMON} \pi_{SPC\_COMMON,\ AVG\_HEIGHT} (\textbf{TreeInfo})$$
</div>
<div class="fragment">
<div style="font-size: 50%; margin-top: 50px;">
Identical to...
$$\sigma_{T.SPC\_COMMON = TI.SPC\_COMMON}\left(\pi_{SPC\_COMMON,\ BORONAME} (\textbf{Trees}) \times \pi_{SPC\_COMMON,\ AVG\_HEIGHT} (\textbf{TreeInfo})\right)$$
</div>
</div>
<div class="fragment" style="margin-top: 100px">
$$R \bowtie_c S \equiv \sigma_c(R \times S)$$
</div>
</section>
<section>
<h3>Join Shorthands</h3>
<p><b>Equi-joins</b> are joins with only equality tests in the condition.</p>
<dl>
<dt class="fragment" data-fragment-index="1">Join on attribute(s)</dt>
<dd class="fragment" data-fragment-index="1">$R \bowtie_{A} S \equiv R \bowtie_{R.A = S.A} S$</dd>
<dd class="fragment" data-fragment-index="1">Same values on the listed attributes</dd>
<dt class="fragment" data-fragment-index="2">Natural Join</dt>
<dd class="fragment" data-fragment-index="2">$R \bowtie S \equiv R \bowtie_{attrs(R) \cap attrs(S)} S$</dd>
<dd class="fragment" data-fragment-index="2">Same values on all shared attributes</dd>
</dl>
</section>
<section>
<h4>Which operators can create duplicates?</h4>
<p style="font-size: 60%">(Which operators behave differently in Set- and Bag-RA?)</p>
<table>
<tr ><th>Operator </th><th>Symbol </th><th >Duplicates?</th></tr>
<tr ><td>Selection </td><td>$\sigma$ </td><td class="fragment" style="color: darkred;">No</td></tr>
<tr class="fragment"><td>Projection </td><td>$\pi$ </td><td class="fragment" style="color: darkgreen;">Yes</td></tr>
<tr class="fragment"><td>Cross-product </td><td>$\times$ </td><td class="fragment" style="color: darkred;">No</td></tr>
<tr class="fragment"><td>Set-difference</td><td>$-$ </td><td class="fragment" style="color: darkred;">No</td></tr>
<tr class="fragment"><td>Union </td><td>$\cup$ </td><td class="fragment" style="color: darkgreen;">Yes</td></tr>
<tr class="fragment"><td>Join </td><td>$\bowtie$</td><td class="fragment" style="color: darkred;">No</td></tr>
</table>
</section>
</section>
<section>
<h3>Group Work</h3>
<p>Find the <b>BORONAME</b>s of all boroughs that <b>do</b> have trees with an average height of below 45 inches</p>
<table style="font-size: small; margin-top: 30px; display: inline-block; vertical-align: middle; margin-right: 50px;">
<tr><th>SPC_COMMON</th><th>AVG_HEIGHT</th></tr>
<tr><td>cedar elm</td><td>60</td></tr>
<tr><td>lacebark elm</td><td>45</td></tr>
<tr><td colspan="2" style="font-weight: bold;">... and more</td></tr>
</table>
<table style="font-size: small; margin-top: 30px; display: inline-block; vertical-align: middle;">
<tr><th>SPC_COMMON</th><th>BORONAME</th></tr>
<tr><td>'honeylocust'</td><td>'Brooklyn'</td></tr>
<tr><td>'honeylocust'</td><td>'Brooklyn'</td></tr>
<tr><td>'American linden'</td><td>'Brooklyn'</td></tr>
<tr><td>'London planetree'</td><td>'Manhattan'</td></tr>
<tr><td>'London planetree'</td><td>'Manhattan'</td></tr>
<tr><td style="font-weight: bold;" colspan="2">... and more</td></tr>
</table>
<div class="fragment">
$$\pi_{BORONAME}(\sigma_{AVG\_HEIGHT < 45}(\textbf{Trees}\bowtie\textbf{TreeInfo}))$$
</div>
<div class="fragment">
$$\pi_{BORONAME}(\textbf{Trees}\bowtie\sigma_{AVG\_HEIGHT < 45}(\textbf{TreeInfo}))$$
</div>
</section>
<section>
<h3>Division ($/$)</h3>
<p>Not typically supported as a primitive operator,<br/>but useful for expressing queries like:</p>
<p style="font-size: 70%; font-weight: bold">Find species that appear in all boroughs</p>
<div style="font-size: 70%">
$$\pi_{BORONAME,\ SPC\_COMMON}(\textbf{Trees}) \;\;/\;\;\pi_{SPC\_COMMON}(\textbf{Trees})$$
(using set relational algebra)
</div>
<p>
$$R / S \equiv \{\; \left<\vec t\right> \;|\; \forall \left<\vec s\right> \in S, \left< \vec t \vec s \right> \in R \;\}$$
</p>
</section>
<section>
<table style="font-size: small; margin-top: 30px; display: inline-block; vertical-align: middle;">
<tr><th>BORO</th> <th>SPC_COMMON</th></tr>
<tr><td>Brooklyn</td> <td>honeylocust</td></tr>
<tr><td>Brooklyn</td> <td>American linden</td></tr>
<tr><td>Brooklyn</td> <td>London planetree</td></tr>
<tr><td>Manhattan</td> <td>honeylocust</td></tr>
<tr><td>Manhattan</td> <td>American linden</td></tr>
<tr><td>Manhattan</td> <td>pin oak</td></tr>
<tr><td>Queens</td> <td>honeylocust</td></tr>
<tr><td>Queens</td> <td>American linden</td></tr>
<tr><td>Bronx</td> <td>honeylocust</td></tr>
</table>
<table style="font-size: 40%; margin-left: 30px; display: inline-block; vertical-align: middle;">
<tr class="fragment"><td style="text-align: left; padding-bottom: 30px;">/ { honeylocust }</td> <td style="text-align: left;">= Brooklyn, Manhattan, Queens, Bronx</td></tr>
<tr class="fragment"><td style="text-align: left; padding-bottom: 30px;">/ { honeylocust, American linden }</td> <td style="text-align: left;">= Brooklyn, Manhattan, Queens</td></tr>
<tr class="fragment"><td style="text-align: left; padding-bottom: 30px;">/ { honeylocust, American linden, pin oak }</td><td style="text-align: left;">= Manhattan</td></tr>
</table>
</section>
<section>
<h3>Group Work</h3>
<p>If time permits: Implement division using other operators.</p>
</section>
</section>
<section>
<section>
<h3>Relational Algebra</h3>
<p>
A simple way to think about and work with<br/>
computations over collections.
</p>
<p>… simple → easy to evaluate</p>
<p>… simple → easy to optimize</p>
<p style="margin-top: 100px">
Next time, Optimizing RA
</p>
</section>
</div></div>
<script src="../reveal.js-3.6.0/js/reveal.js"></script>
<script>
// Full list of configuration options available at:
// https://github.com/hakimel/../reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
slideNumber: true,
transition: 'fade', // none/fade/slide/convex/concave/zoom
chart: {
defaults: {
global: {
title: { fontColor: "#333", fontSize: 24 },
legend: {
labels: { fontColor: "#333", fontSize: 20 },
},
responsiveness: true
},
scale: {
scaleLabel: { fontColor: "#333", fontSize: 20 },
gridLines: { color: "#333", zeroLineColor: "#333" },
ticks: { fontColor: "#333", fontSize: 16 },
}
},
line: { borderColor: [ "rgba(20,220,220,.8)" , "rgba(220,120,120,.8)", "rgba(20,120,220,.8)" ], "borderDash": [ [5,10], [0,0] ]},
bar: { backgroundColor: [
"rgba(220,220,220,0.8)",
"rgba(151,187,205,0.8)",
"rgba(205,151,187,0.8)",
"rgba(187,205,151,0.8)"
]
},
pie: { backgroundColor: [ ["rgba(0,0,0,.8)" , "rgba(220,20,20,.8)", "rgba(20,220,20,.8)", "rgba(220,220,20,.8)", "rgba(20,20,220,.8)"] ]},
radar: { borderColor: [ "rgba(20,220,220,.8)" , "rgba(220,120,120,.8)", "rgba(20,120,220,.8)" ]},
},
// Optional ../reveal.js plugins
dependencies: [
{ src: '../reveal.js-3.6.0/lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: '../reveal.js-3.6.0/plugin/math/math.js',
condition: function() { return true; },
mathjax: '../reveal.js-3.6.0/js/MathJax.js'
},
{ src: '../reveal.js-3.6.0/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: '../reveal.js-3.6.0/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: '../reveal.js-3.6.0/plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: '../reveal.js-3.6.0/plugin/zoom-js/zoom.js', async: true },
{ src: '../reveal.js-3.6.0/plugin/notes/notes.js', async: true },
// Chart.min.js
{ src: '../reveal.js-3.6.0/plugin/chart/Chart.min.js'},
// the plugin
{ src: '../reveal.js-3.6.0/plugin/chart/csv2chart.js'},
{ src: '../reveal.js-3.6.0/plugin/svginline/es6-promise.auto.js', async: false },
{ src: '../reveal.js-3.6.0/plugin/svginline/data-src-svg.js', async: false }
]
});
</script>
</body>
</html>