Skip to content

Commit

Permalink
rebuilt html
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheldon McKay committed May 14, 2015
1 parent 7106649 commit 2a94e56
Show file tree
Hide file tree
Showing 14 changed files with 232 additions and 217 deletions.
8 changes: 4 additions & 4 deletions 01-select.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h1 class="title">Databases and SQL</h1>
<h2 class="subtitle">Selecting Data</h2>
<div id="learning-objectives" class="objectives panel panel-warning">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2>
<h2 id="learning-objectives" class="objectives panel panel-warning"><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2>
</div>
<div class="panel-body">
<ul>
Expand All @@ -44,7 +44,7 @@ <h2><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2
<p>When we are using a spreadsheet, we put formulas into cells to calculate new values based on old ones. When we are using a database, we send commands (usually called <a href="reference.html#query">queries</a>) to a <a href="reference.html#database-manager">database manager</a>: a program that manipulates the database for us. The database manager does whatever lookups and calculations the query specifies, returning the results in a tabular form that we can then use as a starting point for further queries.</p>
<div id="changing-database-managers" class="callout panel panel-info">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pushpin"></span>Changing database managers</h2>
<h2 id="changing-database-managers" class="callout panel panel-info"><span class="glyphicon glyphicon-pushpin"></span>Changing database managers</h2>
</div>
<div class="panel-body">
<p>Every database manager — Oracle, IBM DB2, PostgreSQL, MySQL, Microsoft Access, and SQLite — stores data in a different way, so a database created with one cannot be used directly by another. However, every database manager can import and export data in a variety of formats, so it <em>is</em> possible to move information from one to another.</p>
Expand Down Expand Up @@ -490,15 +490,15 @@ <h2><span class="glyphicon glyphicon-pushpin"></span>Changing database managers<
</table>
<div id="selecting-site-names" class="challenge panel panel-success">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pencil"></span>Selecting Site Names</h2>
<h2 id="selecting-site-names" class="challenge panel panel-success"><span class="glyphicon glyphicon-pencil"></span>Selecting Site Names</h2>
</div>
<div class="panel-body">
<p>Write a query that selects only site names from the <code>Site</code> table.</p>
</div>
</div>
<div id="query-style" class="challenge panel panel-success">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pencil"></span>Query Style</h2>
<h2 id="query-style" class="challenge panel panel-success"><span class="glyphicon glyphicon-pencil"></span>Query Style</h2>
</div>
<div class="panel-body">
<p>Many people format queries as:</p>
Expand Down
6 changes: 3 additions & 3 deletions 02-sort-dup.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h1 class="title">Databases and SQL</h1>
<h2 class="subtitle">Sorting and Removing Duplicates</h2>
<div id="learning-objectives" class="objectives panel panel-warning">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2>
<h2 id="learning-objectives" class="objectives panel panel-warning"><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2>
</div>
<div class="panel-body">
<ul>
Expand Down Expand Up @@ -526,15 +526,15 @@ <h2><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2
</table>
<div id="finding-distinct-dates" class="challenge panel panel-success">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pencil"></span>Finding Distinct Dates</h2>
<h2 id="finding-distinct-dates" class="challenge panel panel-success"><span class="glyphicon glyphicon-pencil"></span>Finding Distinct Dates</h2>
</div>
<div class="panel-body">
<p>Write a query that selects distinct dates from the <code>Visited</code> table.</p>
</div>
</div>
<div id="displaying-full-names" class="challenge panel panel-success">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pencil"></span>Displaying Full Names</h2>
<h2 id="displaying-full-names" class="challenge panel panel-success"><span class="glyphicon glyphicon-pencil"></span>Displaying Full Names</h2>
</div>
<div class="panel-body">
<p>Write a query that displays the full names of the scientists in the <code>Person</code> table, ordered by family name.</p>
Expand Down
10 changes: 5 additions & 5 deletions 03-filter.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h1 class="title">Databases and SQL</h1>
<h2 class="subtitle">Filtering</h2>
<div id="learning-objectives" class="objectives panel panel-warning">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2>
<h2 id="learning-objectives" class="objectives panel panel-warning"><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2>
</div>
<div class="panel-body">
<ul>
Expand Down Expand Up @@ -114,7 +114,7 @@ <h2><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2
</table>
<div id="date-types" class="callout panel panel-info">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pushpin"></span>Date types</h2>
<h2 id="date-types" class="callout panel panel-info"><span class="glyphicon glyphicon-pushpin"></span>Date types</h2>
</div>
<div class="panel-body">
<p>Most database managers have a special data type for dates. In fact, many have two: one for dates, such as “May 31, 1971”, and one for durations, such as “31 days”. SQLite doesn’t: instead, it stores dates as either text (in the ISO-8601 standard format “YYYY-MM-DD HH:MM:SS.SSSS”), real numbers (the number of days since November 24, 4714 BCE), or integers (the number of seconds since midnight, January 1, 1970). If this sounds complicated, it is, but not nearly as complicated as figuring out <a href="http://en.wikipedia.org/wiki/Swedish_calendar">historical dates in Sweden</a>.</p>
Expand Down Expand Up @@ -461,7 +461,7 @@ <h2><span class="glyphicon glyphicon-pushpin"></span>Date types</h2>
</blockquote>
<div id="fix-this-query" class="challenge panel panel-success">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pencil"></span>Fix This Query</h2>
<h2 id="fix-this-query" class="challenge panel panel-success"><span class="glyphicon glyphicon-pencil"></span>Fix This Query</h2>
</div>
<div class="panel-body">
<p>Suppose we want to select all sites that lie more than 30 degrees from the poles. Our first query is:</p>
Expand All @@ -471,15 +471,15 @@ <h2><span class="glyphicon glyphicon-pencil"></span>Fix This Query</h2>
</div>
<div id="finding-outliers" class="challenge panel panel-success">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pencil"></span>Finding Outliers</h2>
<h2 id="finding-outliers" class="challenge panel panel-success"><span class="glyphicon glyphicon-pencil"></span>Finding Outliers</h2>
</div>
<div class="panel-body">
<p>Normalized salinity readings are supposed to be between 0.0 and 1.0. Write a query that selects all records from <code>Survey</code> with salinity values outside this range.</p>
</div>
</div>
<div id="matching-patterns" class="challenge panel panel-success">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pencil"></span>Matching Patterns</h2>
<h2 id="matching-patterns" class="challenge panel panel-success"><span class="glyphicon glyphicon-pencil"></span>Matching Patterns</h2>
</div>
<div class="panel-body">
<p>Which of these expressions are true?</p>
Expand Down
8 changes: 4 additions & 4 deletions 04-calc.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h1 class="title">Databases and SQL</h1>
<h2 class="subtitle">Calculating New Values</h2>
<div id="learning-objectives" class="objectives panel panel-warning">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2>
<h2 id="learning-objectives" class="objectives panel panel-warning"><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2>
</div>
<div class="panel-body">
<ul>
Expand Down Expand Up @@ -129,15 +129,15 @@ <h2><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2
</table>
<div id="fixing-salinity-readings" class="challenge panel panel-success">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pencil"></span>Fixing Salinity Readings</h2>
<h2 id="fixing-salinity-readings" class="challenge panel panel-success"><span class="glyphicon glyphicon-pencil"></span>Fixing Salinity Readings</h2>
</div>
<div class="panel-body">
<p>After further reading, we realize that Valentina Roerich was reporting salinity as percentages. Write a query that returns all of her salinity measurements from the <code>Survey</code> table with the values divided by 100.</p>
</div>
</div>
<div id="unions" class="challenge panel panel-success">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pencil"></span>Unions</h2>
<h2 id="unions" class="challenge panel panel-success"><span class="glyphicon glyphicon-pencil"></span>Unions</h2>
</div>
<div class="panel-body">
<p>The <code>UNION</code> operator combines the results of two queries:</p>
Expand Down Expand Up @@ -210,7 +210,7 @@ <h2><span class="glyphicon glyphicon-pencil"></span>Unions</h2>
</div>
<div id="selecting-major-site-identifiers" class="challenge panel panel-success">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pencil"></span>Selecting Major Site Identifiers</h2>
<h2 id="selecting-major-site-identifiers" class="challenge panel panel-success"><span class="glyphicon glyphicon-pencil"></span>Selecting Major Site Identifiers</h2>
</div>
<div class="panel-body">
<p>The site identifiers in the <code>Visited</code> table have two parts separated by a ‘-’:</p>
Expand Down
8 changes: 4 additions & 4 deletions 05-null.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h1 class="title">Databases and SQL</h1>
<h2 class="subtitle">Missing Data</h2>
<div id="learning-objectives" class="objectives panel panel-warning">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2>
<h2 id="learning-objectives" class="objectives panel panel-warning"><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2>
</div>
<div class="panel-body">
<ul>
Expand Down Expand Up @@ -312,15 +312,15 @@ <h2><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2
<p>In contrast to arithmetic or Boolean operators, aggregation functions that combine multiple values, such as <code>min</code>, <code>max</code> or <code>avg</code>, <em>ignore</em> <code>null</code> values. In the majority of cases, this is a desirable output: for example, unknown values are thus not affecting our data when we are averaging it. Aggregation functions will be addressed in more detail in <a href="06-agg.html">the next section</a>.</p>
<div id="sorting-by-known-date" class="challenge panel panel-success">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pencil"></span>Sorting by Known Date</h2>
<h2 id="sorting-by-known-date" class="challenge panel panel-success"><span class="glyphicon glyphicon-pencil"></span>Sorting by Known Date</h2>
</div>
<div class="panel-body">
<p>Write a query that sorts the records in <code>Visited</code> by date, omitting entries for which the date is not known (i.e., is null).</p>
</div>
</div>
<div id="null-in-a-set" class="challenge panel panel-success">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pencil"></span>NULL in a Set</h2>
<h2 id="null-in-a-set" class="challenge panel panel-success"><span class="glyphicon glyphicon-pencil"></span>NULL in a Set</h2>
</div>
<div class="panel-body">
<p>What do you expect the query:</p>
Expand All @@ -330,7 +330,7 @@ <h2><span class="glyphicon glyphicon-pencil"></span>NULL in a Set</h2>
</div>
<div id="pros-and-cons-of-sentinels" class="challenge panel panel-success">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pencil"></span>Pros and Cons of Sentinels</h2>
<h2 id="pros-and-cons-of-sentinels" class="challenge panel panel-success"><span class="glyphicon glyphicon-pencil"></span>Pros and Cons of Sentinels</h2>
</div>
<div class="panel-body">
<p>Some database designers prefer to use a <a href="reference.html#sentinel-value">sentinel value</a>) to mark missing data rather than <code>null</code>. For example, they will use the date “0000-00-00” to mark a missing date, or -1.0 to mark a missing salinity or radiation reading (since actual readings cannot be negative). What does this simplify? What burdens or risks does it introduce?</p>
Expand Down
245 changes: 109 additions & 136 deletions 06-agg.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions 07-join.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h1 class="title">Databases and SQL</h1>
<h2 class="subtitle">Combining Data</h2>
<div id="learning-objectives" class="objectives panel panel-warning">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2>
<h2 id="learning-objectives" class="objectives panel panel-warning"><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2>
</div>
<div class="panel-body">
<ul>
Expand Down Expand Up @@ -573,23 +573,23 @@ <h2><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2
</table>
<div id="listing-radiation-readings" class="challenge panel panel-success">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pencil"></span>Listing Radiation Readings</h2>
<h2 id="listing-radiation-readings" class="challenge panel panel-success"><span class="glyphicon glyphicon-pencil"></span>Listing Radiation Readings</h2>
</div>
<div class="panel-body">
<p>Write a query that lists all radiation readings from the DR-1 site.</p>
</div>
</div>
<div id="wheres-frank" class="challenge panel panel-success">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pencil"></span>Where’s Frank?</h2>
<h2 id="wheres-frank" class="challenge panel panel-success"><span class="glyphicon glyphicon-pencil"></span>Where’s Frank?</h2>
</div>
<div class="panel-body">
<p>Write a query that lists all sites visited by people named “Frank”.</p>
</div>
</div>
<div id="reading-queries" class="challenge panel panel-success">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pencil"></span>Reading Queries</h2>
<h2 id="reading-queries" class="challenge panel panel-success"><span class="glyphicon glyphicon-pencil"></span>Reading Queries</h2>
</div>
<div class="panel-body">
<p>Describe in your own words what the following query produces:</p>
Expand All @@ -599,7 +599,7 @@ <h2><span class="glyphicon glyphicon-pencil"></span>Reading Queries</h2>
</div>
<div id="who-has-been-where" class="challenge panel panel-success">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pencil"></span>Who has been where?</h2>
<h2 id="who-has-been-where" class="challenge panel panel-success"><span class="glyphicon glyphicon-pencil"></span>Who has been where?</h2>
</div>
<div class="panel-body">
<p>Write a query that shows each site with exact location (lat, long) ordered by visited date, followed by personal name and family name of the person who visited the site and the type of measurement taken and its reading. Please avoid all null values. Tip: you should get 15 records with 8 fields.</p>
Expand Down
6 changes: 3 additions & 3 deletions 08-hygiene.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h1 class="title">Databases and SQL</h1>
<h2 class="subtitle">Data Hygiene</h2>
<div id="learning-objectives" class="objectives panel panel-warning">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2>
<h2 id="learning-objectives" class="objectives panel panel-warning"><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2>
</div>
<div class="panel-body">
<ul>
Expand Down Expand Up @@ -112,7 +112,7 @@ <h2><span class="glyphicon glyphicon-certificate"></span>Learning Objectives</h2
<p>Stepping back, data and the tools used to store it have a symbiotic relationship: we use tables and joins because it’s efficient, provided our data is organized a certain way, but organize our data that way because we have tools to manipulate it efficiently. As anthropologists say, the tool shapes the hand that shapes the tool.</p>
<div id="identifying-atomic-values" class="challenge panel panel-success">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pencil"></span>Identifying Atomic Values</h2>
<h2 id="identifying-atomic-values" class="challenge panel panel-success"><span class="glyphicon glyphicon-pencil"></span>Identifying Atomic Values</h2>
</div>
<div class="panel-body">
<p>Which of the following are atomic values? Which are not? Why?</p>
Expand All @@ -126,7 +126,7 @@ <h2><span class="glyphicon glyphicon-pencil"></span>Identifying Atomic Values</h
</div>
<div id="identifying-a-primary-key" class="challenge panel panel-success">
<div class="panel-heading">
<h2><span class="glyphicon glyphicon-pencil"></span>Identifying a Primary Key</h2>
<h2 id="identifying-a-primary-key" class="challenge panel panel-success"><span class="glyphicon glyphicon-pencil"></span>Identifying a Primary Key</h2>
</div>
<div class="panel-body">
<p>What is the primary key in this table? I.e., what value or combination of values uniquely identifies a record?</p>
Expand Down
Loading

0 comments on commit 2a94e56

Please sign in to comment.