Skip to content

Commit

Permalink
knit after pr
Browse files Browse the repository at this point in the history
  • Loading branch information
MicheleTobias committed Apr 17, 2024
1 parent d0ac0c7 commit d7455a9
Show file tree
Hide file tree
Showing 11 changed files with 120 additions and 87 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ _[UC Davis DataLab](https://datalab.ucdavis.edu/)_
_Spring 2022_
_Instructor: Nicholas Alonzo <<nicholas@diversifyds.org>>_
_Authors_: [Michele Tobias](https://github.com/MicheleTobias), [Nicholas Alonzo](https://github.com/nicholas-alonzo) & [Nick Ulle](https://github.com/nick-ulle)
_Editors:_ [Nick Ulle](https://github.com/nick-ulle) and [Pamela Reynolds](https://github.com/plnreynolds)
_Editors:_ [Nick Ulle](https://github.com/nick-ulle), [Pamela Reynolds](https://github.com/plnreynolds), and [Elise Hellwig](https://github.com/elisehellwig)

* [Reader](https://ucdavisdatalab.github.io/workshop_intro_to_sql/)
* [Event Page](https://datalab.ucdavis.edu/eventscalendar/introduction-to-sql-for-querying-databases/)
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<meta name="author" content="Nick Ulle" />


<meta name="date" content="2024-04-16" />
<meta name="date" content="2024-04-17" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
Binary file modified docs/_main.pdf
Binary file not shown.
135 changes: 72 additions & 63 deletions docs/concepts.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<meta name="author" content="Nick Ulle" />


<meta name="date" content="2024-04-16" />
<meta name="date" content="2024-04-17" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down Expand Up @@ -181,132 +181,136 @@ <h1><span class="header-section-number">1</span> Concepts<a href="concepts.html#
<h2><span class="header-section-number">1.1</span> What is a Relational Database?<a href="concepts.html#what-is-a-relational-database" class="anchor-section" aria-label="Anchor link to header"></a></h2>
<p>A <strong>relational database</strong> is a collection of tables (organized in rows and columns of data) that are related to each other in some way.</p>
<p>Database tables are analogous to CSV files, spreadsheets in Excel, or data frames in programming languages like R or Python.</p>
<p>Ideally each table can be connected to another table by a column that both tables have that store the information to match up the rows. This column is called a <strong>key</strong>. For example, a key commonly used on campus is your student or employee ID number.</p>
<p>Ideally each table can be connected to another table by a column that is present
in both tables. That column may have different numbers of observations in each
table, but the values will match up. This column is called a <strong>key</strong>. For
example, a key commonly used on campus is your student or employee ID number.</p>
<p>Let’s look at an example dataset of fictional student data with data about courses, grades, and employment. Can we say anything about the relationship between course grades and employment based on this data?</p>
<p><strong>Table: Student</strong></p>
<table>
<thead>
<tr class="header">
<th>ID</th>
<th>Name</th>
<th align="left">ID</th>
<th align="left">Name</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>123</td>
<td>Jane Smith</td>
<td align="left">123</td>
<td align="left">Jane Smith</td>
</tr>
<tr class="even">
<td>456</td>
<td>Maria Martinez</td>
<td align="left">456</td>
<td align="left">Maria Martinez</td>
</tr>
<tr class="odd">
<td>789</td>
<td>Paul Jones</td>
<td align="left">789</td>
<td align="left">Paul Jones</td>
</tr>
</tbody>
</table>
<p><strong>Table: Courses</strong></p>
<table>
<thead>
<tr class="header">
<th>ID</th>
<th>Course</th>
<th>Grade</th>
<th align="left">ID</th>
<th align="left">Course</th>
<th align="left">Grade</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>123</td>
<td>Calculus</td>
<td>A-</td>
<td align="left">123</td>
<td align="left">Calculus</td>
<td align="left">A-</td>
</tr>
<tr class="even">
<td>456</td>
<td>Calculus</td>
<td>A</td>
<td align="left">456</td>
<td align="left">Calculus</td>
<td align="left">A</td>
</tr>
<tr class="odd">
<td>789</td>
<td>Calculus</td>
<td>C+</td>
<td align="left">789</td>
<td align="left">Calculus</td>
<td align="left">C+</td>
</tr>
<tr class="even">
<td>123</td>
<td>Data Science</td>
<td>A-</td>
<td align="left">123</td>
<td align="left">Data Science</td>
<td align="left">A-</td>
</tr>
<tr class="odd">
<td>456</td>
<td>Data Science</td>
<td>B</td>
<td align="left">456</td>
<td align="left">Data Science</td>
<td align="left">B</td>
</tr>
<tr class="even">
<td>789</td>
<td>Data Science</td>
<td>B-</td>
<td align="left">789</td>
<td align="left">Data Science</td>
<td align="left">B-</td>
</tr>
</tbody>
</table>
<p><strong>Table: Employment</strong></p>
<table>
<thead>
<tr class="header">
<th>ID</th>
<th>Position</th>
<th>Employer</th>
<th>HoursPerWeek</th>
<th align="left">ID</th>
<th align="left">Position</th>
<th align="left">Employer</th>
<th align="left">HoursPerWeek</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>123</td>
<td>Student Assistant</td>
<td>University Research Lab</td>
<td>5</td>
<td align="left">123</td>
<td align="left">Student Assistant</td>
<td align="left">University Research Lab</td>
<td align="left">5</td>
</tr>
<tr class="even">
<td>456</td>
<td>Customer Service</td>
<td>Alumni Center</td>
<td>5</td>
<td align="left">456</td>
<td align="left">Customer Service</td>
<td align="left">Alumni Center</td>
<td align="left">5</td>
</tr>
<tr class="odd">
<td>456</td>
<td>Research Assistant</td>
<td>University Research Lab</td>
<td>15</td>
<td align="left">456</td>
<td align="left">Research Assistant</td>
<td align="left">University Research Lab</td>
<td align="left">15</td>
</tr>
<tr class="even">
<td>789</td>
<td>Student Assistant</td>
<td>University Research Lab</td>
<td>10</td>
<td align="left">789</td>
<td align="left">Student Assistant</td>
<td align="left">University Research Lab</td>
<td align="left">10</td>
</tr>
<tr class="odd">
<td>789</td>
<td>Stock Room</td>
<td>Medical Supplier</td>
<td>20</td>
<td align="left">789</td>
<td align="left">Stock Room</td>
<td align="left">Medical Supplier</td>
<td align="left">20</td>
</tr>
<tr class="even">
<td>789</td>
<td>Customer Service</td>
<td>Alumi Center</td>
<td>15</td>
<td align="left">789</td>
<td align="left">Customer Service</td>
<td align="left">Alumi Center</td>
<td align="left">15</td>
</tr>
</tbody>
</table>
</div>
<div id="what-is-sql" class="section level2 hasAnchor" number="1.2">
<h2><span class="header-section-number">1.2</span> What is SQL?<a href="concepts.html#what-is-sql" class="anchor-section" aria-label="Anchor link to header"></a></h2>
<p>SQL stands for <strong>structured query language</strong>. SQL is a programming language that allows you to request (query) information from a database using a standard set of keywords. You can pronounce SQL as “ess cue ell” or “sequel”.</p>
<p>SQL stands for <strong>structured query language</strong>. SQL is a programming language that allows you to request (query) information from a database using a standard set of keywords. You can pronounce SQL as “ess cue ell” or “sequel”.
<!-- love the pronunciation guide --></p>
<div id="what-kinds-of-questions-can-sql-answer" class="section level3 hasAnchor" number="1.2.1">
<h3><span class="header-section-number">1.2.1</span> What kinds of questions can SQL answer?<a href="concepts.html#what-kinds-of-questions-can-sql-answer" class="anchor-section" aria-label="Anchor link to header"></a></h3>
<p>SQL excels at extracting and combining information from large datasets. Some questions you might ask with SQL include:</p>
<ul>
<li>How many items are there in my data with a specific label?</li>
<li>What re the unique values in a given column?</li>
<li>What are the unique values in a given column?</li>
<li>Which records (rows) relate to a specific time period in my data?</li>
</ul>
</div>
Expand All @@ -318,6 +322,8 @@ <h2><span class="header-section-number">1.3</span> What is a Relational Database
<p><img src="images/sqlite-logo.png" />
<!-- https://en.wikipedia.org/wiki/SQLite#/media/File:SQLite370.svg --></p>
<p>Every RDBMS has its own implementation or “dialect” of SQL. In other words, the set of SQL keywords supported differs slightly from one RDBMS to another, and sometimes queries have to be written differently, but the basics are the same. Details about the supported keywords for a given RDBMS can be found in that system’s documentation. The keywords covered in this workshop are supported by most systems.</p>
<!-- I might add something here about how when googling, it is important to specify -->
<!-- which version of SQL you are using (ex sqlite, postgres, ms server) -->
<p>Some RDBMS allow you to add functions with extensions. For example, the PostGIS extension adds keywords to PostgreSQL to all you to work with location information to do spatial analysis.</p>
</div>
<div id="advantages-disadvantages-of-sql" class="section level2 hasAnchor" number="1.4">
Expand All @@ -341,14 +347,17 @@ <h2><span class="header-section-number">1.4</span> Advantages &amp; Disadvantage
</ul></li>
<li>Data management
<ul>
<li>One database file stores many, many tables which is represented as one file in your file browser</li>
<li>One database file is the equivalent to many, many spreadsheet files (like csvs or xlsx files)</li>
<li>Write a query instead of making a new files or tabs</li>
</ul></li>
</ul>
<p>What does SQL not do well?</p>
<ul>
<li>Most RDBMS do not visualize data, however, you can connect your database to visualization tools to perform these kinds of tasks seamlessly.</li>
<li>SQL is designed to work with tabular data. If your data is another type - for example graph data or tree data - you might want to explore other database types.</li>
<li>The SQL language is designed for data querying not data analysis. If you want
to run statistics on your data you can connect to your database from a
programming language like R or python, or from statistical software.</li>
<li>SQL assumes you work with tabular data. If your data is another type - for example graph data or tree data - you might want to explore other database types.</li>
</ul>
<!--
* You can manage multiple data sources
Expand Down
4 changes: 3 additions & 1 deletion docs/conclusion.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<meta name="author" content="Nick Ulle" />


<meta name="date" content="2024-04-16" />
<meta name="date" content="2024-04-17" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down Expand Up @@ -178,6 +178,8 @@ <h1>
<div id="conclusion" class="section level1 hasAnchor" number="5">
<h1><span class="header-section-number">5</span> Conclusion<a href="conclusion.html#conclusion" class="anchor-section" aria-label="Anchor link to header"></a></h1>
<p>We covered a wide variety of SQL processes you might need in setting up a database and querying data. Did we cover everything you might need to know? Of course not. It’s only a 2 hour workshop and SQL is a big language, but we’ve learned enough terminology and seen enough typical workflows for you to get started. To help you learn more and expand your SQL skills, we’ve assembled a list of resources in the Resources section of the reader.</p>
<!-- I'm not sure an entire conclusions section is really necessary. I might
just add this at the top of the resources section -->

</div>
</section>
Expand Down
4 changes: 3 additions & 1 deletion docs/database-set-up.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<meta name="author" content="Nick Ulle" />


<meta name="date" content="2024-04-16" />
<meta name="date" content="2024-04-17" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down Expand Up @@ -228,6 +228,8 @@ <h3><span class="header-section-number">3.1.2</span> Load the Database<a href="d
<li>You are now connected to the database and can execute SQL to the database!</li>
</ul></li>
</ol>
<!-- What are the [3] and [4] for? Also the file isn't called lcdb, so you
might want to change how you refer to it or change the name of the file -->
</div>
<div id="saving-scripts" class="section level3 hasAnchor" number="3.1.3">
<h3><span class="header-section-number">3.1.3</span> Saving Scripts<a href="database-set-up.html#saving-scripts" class="anchor-section" aria-label="Anchor link to header"></a></h3>
Expand Down
Loading

0 comments on commit d7455a9

Please sign in to comment.