From 58ed8204368b73b2d291b5825ece1da3cbc06ad5 Mon Sep 17 00:00:00 2001 From: "Zhian N. Kamvar" Date: Tue, 30 May 2023 07:02:29 -0700 Subject: [PATCH 1/8] fix setup link this will address https://github.com/LibraryCarpentry/lc-sql/issues/154 --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index 7bc669c9..abb9eebf 100644 --- a/index.md +++ b/index.md @@ -8,7 +8,7 @@ This Library Carpentry lesson introduces librarians to relational database manag ## Before You Start: -You will need to install **DB Browser for SQLite** and download the **doaj-article-sample** database. See [Setup](https://librarycarpentry.org/lc-sql/setup.html) for instructions and further information. +You will need to install **DB Browser for SQLite** and download the **doaj-article-sample** database. See [Setup](learners/setup.md) for instructions and further information. :::::::::::::::::::::::::::::::::::::::::::::::::: From 89b45c1f9ec4056b2178e56ff703db725812da7f Mon Sep 17 00:00:00 2001 From: JCSzamosi Date: Mon, 12 Jun 2023 17:40:21 -0400 Subject: [PATCH 2/8] Clarify issues links in CONTRIBUTING.md --- CONTRIBUTING.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ec44704c..4f76a3ad 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -26,12 +26,13 @@ introduce yourself and to meet some of our community members. 2. If you have a [GitHub][github] account, or are willing to [create one][github-join], but do not know how to use Git, you can report problems - or suggest improvements by [creating an issue][issues]. This allows us to - assign the item to someone and to respond to it in a threaded discussion. + or suggest improvements by [creating an issue][repo-issues]. This allows us + to assign the item to someone and to respond to it in a threaded discussion. 3. If you are comfortable with Git, and would like to add or change material, you can submit a pull request (PR). Instructions for doing this are - [included below](#using-github). + [included below](#using-github). For inspiration about changes that need to + be made, check out the [list of open issues][issues] across the Carpentries. Note: if you want to build the website locally, please refer to [The Workbench documentation][template-doc]. @@ -49,8 +50,8 @@ There are many ways to contribute, from writing new exercises and improving existing ones to updating or filling in the documentation and submitting [bug reports][issues] about things that do not work, are not clear, or are missing. If you are looking for ideas, please see [the list of issues for this -repository][repo], or the issues for [Data Carpentry][dc-issues], [Library -Carpentry][lc-issues], and [Software Carpentry][swc-issues] projects. +repository][repo-issues], or the issues for [Data Carpentry][dc-issues], +[Library Carpentry][lc-issues], and [Software Carpentry][swc-issues] projects. Comments on issues and reviews of pull requests are just as welcome: we are smarter together than we are on our own. **Reviews from novices and newcomers @@ -102,6 +103,7 @@ media, slack, newsletters, and email lists. You can also [reach us by email][contact]. [repo]: https://example.com/FIXME +[repo-issues]: https://example.com/FIXME/issues [contact]: mailto:team@carpentries.org [cp-site]: https://carpentries.org/ [dc-issues]: https://github.com/issues?q=user%3Adatacarpentry @@ -111,7 +113,7 @@ email][contact]. [github]: https://github.com [github-flow]: https://guides.github.com/introduction/flow/ [github-join]: https://github.com/join -[how-contribute]: https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github +[how-contribute]: https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github [issues]: https://carpentries.org/help-wanted-issues/ [lc-issues]: https://github.com/issues?q=user%3ALibraryCarpentry [swc-issues]: https://github.com/issues?q=user%3Aswcarpentry From 04c1f5dadd0e1c796ed0bb64f5718038e3575ecf Mon Sep 17 00:00:00 2001 From: Benson Muite Date: Wed, 21 Jun 2023 14:39:08 +0300 Subject: [PATCH 3/8] Break long line for readability Make it easier to read the rendered version. --- episodes/04-ordering-commenting.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/episodes/04-ordering-commenting.md b/episodes/04-ordering-commenting.md index ef06f3aa..a7c5f598 100644 --- a/episodes/04-ordering-commenting.md +++ b/episodes/04-ordering-commenting.md @@ -73,8 +73,10 @@ their effects as we went along. For complex queries, this is a good strategy, t When the queries become more complex, it can be useful to add comments to express to yourself, or to others, what you are doing with your query. Comments help explain the logic of a section and provide context for anyone reading the query. It's essentially a way of making notes within your SQL. In SQL, comments begin using \-- and end at the end of the line. To mark a whole paragraph as a comment, you can enclose it with the characters /\* and \*/. For example, a commented version of the above query can be written as: ``` -/*In this section, even though JOINS (see link below this code block) are not introduced until Episode 6, we want to give an example how to -join multiple tables becasue they represent a good example of using comments in SQL to explain more complex queries.*/ +/*In this section, even though JOINS (see link below this code block) +are not introduced until Episode 6, we want to give an example how to +join multiple tables becasue they represent a good example of using +comments in SQL to explain more complex queries.*/ -- First we mention all the fields we want to display SELECT articles.Title, articles.First_Author, journals.Journal_Title, publishers.Publisher From 93a22c0bb6b37c4a7d73048c62fc46da0e6dee14 Mon Sep 17 00:00:00 2001 From: Kaitlin Newson Date: Tue, 29 Aug 2023 14:58:59 -0300 Subject: [PATCH 4/8] Codeblock styles and minor typos --- episodes/02-selecting-sorting-data.md | 2 +- episodes/04-ordering-commenting.md | 4 ++-- episodes/06-joins-aliases.md | 2 +- episodes/08-database-design.md | 2 +- episodes/09-create.md | 2 +- learners/reference.md | 28 +++++++++++++-------------- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/episodes/02-selecting-sorting-data.md b/episodes/02-selecting-sorting-data.md index 3b277c3b..bb316357 100644 --- a/episodes/02-selecting-sorting-data.md +++ b/episodes/02-selecting-sorting-data.md @@ -41,7 +41,7 @@ In the first query above, we have capitalized the words `SELECT` and `FROM` beca Example: -``` +```sql SELECT Title, Authors, ISSNs, Year FROM Articles; ``` diff --git a/episodes/04-ordering-commenting.md b/episodes/04-ordering-commenting.md index ef06f3aa..347ad843 100644 --- a/episodes/04-ordering-commenting.md +++ b/episodes/04-ordering-commenting.md @@ -72,9 +72,9 @@ their effects as we went along. For complex queries, this is a good strategy, t When the queries become more complex, it can be useful to add comments to express to yourself, or to others, what you are doing with your query. Comments help explain the logic of a section and provide context for anyone reading the query. It's essentially a way of making notes within your SQL. In SQL, comments begin using \-- and end at the end of the line. To mark a whole paragraph as a comment, you can enclose it with the characters /\* and \*/. For example, a commented version of the above query can be written as: -``` +```sql /*In this section, even though JOINS (see link below this code block) are not introduced until Episode 6, we want to give an example how to -join multiple tables becasue they represent a good example of using comments in SQL to explain more complex queries.*/ +join multiple tables because they represent a good example of using comments in SQL to explain more complex queries.*/ -- First we mention all the fields we want to display SELECT articles.Title, articles.First_Author, journals.Journal_Title, publishers.Publisher diff --git a/episodes/06-joins-aliases.md b/episodes/06-joins-aliases.md index 678fecfe..9bd30538 100644 --- a/episodes/06-joins-aliases.md +++ b/episodes/06-joins-aliases.md @@ -107,7 +107,7 @@ ON publishers.id = journals.PublisherId; ::::::::::::::::::::::::::::::::::::::: challenge -## Challenge: +## Challenge Write a query that returns the `Journal_Title`, `Publisher` name, and number of articles published, ordered by number of articles in descending order. diff --git a/episodes/08-database-design.md b/episodes/08-database-design.md index 6ab0e776..d544d0f8 100644 --- a/episodes/08-database-design.md +++ b/episodes/08-database-design.md @@ -76,7 +76,7 @@ Conceptually, we know that a journal has only one publisher but a publisher can ## More Terminology -The degree of relationship between entities is known as their 'cardinality'. Using the journals-publishers example, the 'publisheres' tble contains a primary key (PK) called 'id'. When the PK is used to create a connection between the original table and a different table, it is called a foreign key (FK) in the other table. To follow the example, we see a field in the 'journal' table called PublisherID that contains the values from the 'id' field in the 'publisher' table, connected the two tables. +The degree of relationship between entities is known as their 'cardinality'. Using the journals-publishers example, the 'publishers' table contains a primary key (PK) called 'id'. When the PK is used to create a connection between the original table and a different table, it is called a foreign key (FK) in the other table. To follow the example, we see a field in the 'journal' table called PublisherID that contains the values from the 'id' field in the 'publisher' table, connecting the two tables. There are 4 main types of relationships between tables: diff --git a/episodes/09-create.md b/episodes/09-create.md index e084e57a..ffe7da04 100644 --- a/episodes/09-create.md +++ b/episodes/09-create.md @@ -175,7 +175,7 @@ stored in any particular order.) :::::::::::::::::::::::::::::::::::::::::::::::::: -Adaped from the Software Carpentry Course "Databases and SQL", Chapter 9. 'Creating and Modifying Data'. +Adapted from the Software Carpentry Course "Databases and SQL", Chapter 9. 'Creating and Modifying Data'. :::::::::::::::::::::::::::::::::::::::: keypoints diff --git a/learners/reference.md b/learners/reference.md index bd1fbd16..9297f0c2 100644 --- a/learners/reference.md +++ b/learners/reference.md @@ -8,28 +8,28 @@ title: 'SQL Cheat Sheet' ### Basic query -``` +```sql SELECT column_names FROM table_name; ``` - selects only the specified columns from a table. -``` +```sql SELECT * FROM table_name; ``` - select all of the columns in a table. -``` -SELECT DINSTINCT column_name +```sql +SELECT DISTINCT column_name FROM table_name; ``` - selects only the unique values from a table. -``` +```sql SELECT column_names FROM table_name WHERE column_name operator value; @@ -39,7 +39,7 @@ WHERE column_name operator value; - you can use operators `=`,`<`,`>`, etc - you can also combine tests using `AND`, `OR` in the WHERE clause. -``` +```sql SELECT column_names FROM table_name WHERE column_name IN (value1, value2, value3); @@ -47,7 +47,7 @@ WHERE column_name IN (value1, value2, value3); - selects only the data where column\_name equals to `value1`, `value2`, and so on. -``` +```sql SELECT column_names FROM table_name ORDER BY column_name ASC; @@ -59,7 +59,7 @@ ORDER BY column_name ASC; ### Aggregation -``` +```sql SELECT aggregate_function(column_name) FROM table_name; ``` @@ -68,7 +68,7 @@ FROM table_name; - E.g. `SELECT COUNT(*) FROM table_name` will display the total number of records. - You can use aggregate functions `COUNT`, `SUM`, `MAX`, `MIN`, `AVG`. -``` +```sql SELECT column_name, aggregate_function(column_name) FROM table_name WHERE column_name operator value @@ -77,7 +77,7 @@ GROUP BY column_name; - `GROUP BY` tells SQL what field or fields we want to use to aggregate the data. If we want to group by multiple fields, we give `GROUP BY` a comma separated list. -``` +```sql SELECT column_name, aggregate_function(column_name) FROM table_name GROUP BY column_name @@ -90,7 +90,7 @@ HAVING aggregate_function(column_name) operator value; ### Joins and aliases -``` +```sql SELECT column_names FROM table_name1 JOIN table_name2 @@ -100,7 +100,7 @@ ON table_name1.column_name = table_name2.column_name; - Combine data from two tables where the values of column\_name in the two tables are the same. - Instead of `ON`, you can use the `USING` keyword as a shorthand. E.g. `USING (coolumn_name)`. -``` +```sql SELECT alias1.column_name1, alias1.column_name2, alias2.column_name3 FROM table_name1 AS alias1 JOIN table_name2 AS alias2 @@ -114,7 +114,7 @@ ON alias1.column_name = alias2.column_name; ### Saving queries -``` +```sql CREATE VIEW viewname AS SELECT column_names FROM table_name; @@ -126,7 +126,7 @@ FROM table_name; ### Commenting -``` +```sql -- Select all columns SELECT * -- From the table_name From 1a53095d6ffc20f14c2eab6ec25be195052d023b Mon Sep 17 00:00:00 2001 From: Robert Davey Date: Thu, 31 Aug 2023 15:34:06 +0100 Subject: [PATCH 5/8] Update slack links --- learners/discuss.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/learners/discuss.md b/learners/discuss.md index 31723e52..5a054b89 100644 --- a/learners/discuss.md +++ b/learners/discuss.md @@ -5,7 +5,7 @@ title: Discussion There are many ways to discuss Library Carpentry lessons: - Join our [Gitter discussion forum](https://gitter.im/LibraryCarpentry/). -- Join our [Slack organisation](https://swc-slack-invite.herokuapp.com/) and #libraries channel. +- Join our [Slack organisation](https://slack-invite.carpentries.org/) and #libraries channel. - Stay in touch with our [Topicbox Group](https://carpentries.topicbox.com/groups/discuss-library-carpentry). - Follow updates on [Twitter](https://twitter.com/LibCarpentry). - Make a suggestion or correct an error by [raising an Issue](https://github.com/LibraryCarpentry/lc-sql/issues) or [submitting a pull request](https://github.com/LibraryCarpentry/lc-sql/pulls). From 3215982f3227da9529842288133f64160eef6630 Mon Sep 17 00:00:00 2001 From: zkamvar Date: Tue, 12 Sep 2023 00:18:06 +0000 Subject: [PATCH 6/8] [actions] update sandpaper workflow to version 0.13.0 --- .github/workflows/README.md | 2 +- .github/workflows/sandpaper-version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 101967e4..d6edf88d 100755 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -96,7 +96,7 @@ are okay. This update is run ~~weekly or~~ on demand. -### 03 Maintain: Update Pacakge Cache (update-cache.yaml) +### 03 Maintain: Update Package Cache (update-cache.yaml) For lessons that have generated content, we use {renv} to ensure that the output is stable. This is controlled by a single lockfile which documents the packages diff --git a/.github/workflows/sandpaper-version.txt b/.github/workflows/sandpaper-version.txt index 4aa09069..54d1a4f2 100644 --- a/.github/workflows/sandpaper-version.txt +++ b/.github/workflows/sandpaper-version.txt @@ -1 +1 @@ -0.11.15 +0.13.0 From b8311eafff138838b53ce84d6e0d04854951cbb9 Mon Sep 17 00:00:00 2001 From: Toby Hodges Date: Tue, 19 Sep 2023 19:21:05 +0200 Subject: [PATCH 7/8] point to lesson repository --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4f76a3ad..1030f9c1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -102,8 +102,8 @@ community listed at including via social media, slack, newsletters, and email lists. You can also [reach us by email][contact]. -[repo]: https://example.com/FIXME -[repo-issues]: https://example.com/FIXME/issues +[repo]: https://github.com/LibraryCarpentry/lc-sql +[repo-issues]: https://github.com/LibraryCarpentry/lc-sql/issues [contact]: mailto:team@carpentries.org [cp-site]: https://carpentries.org/ [dc-issues]: https://github.com/issues?q=user%3Adatacarpentry From b778033f90ff89de93f3a6eeed247123f7fa9728 Mon Sep 17 00:00:00 2001 From: Toby Hodges Date: Tue, 19 Sep 2023 19:46:14 +0200 Subject: [PATCH 8/8] Update DOI for example dataset --- learners/setup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/learners/setup.md b/learners/setup.md index 74c08d31..a16dc319 100644 --- a/learners/setup.md +++ b/learners/setup.md @@ -15,7 +15,7 @@ Note: on Windows, the PortableApp download is recommended as the regular version To import data, you'll need to open DB Browser for SQLite and download a zip file containing the data files for this tutorial. 1. Download the data files doaj-article-sample.zip from - [Zenodo](https://doi.org/10.5281/zenodo.2822005). + [Zenodo](https://doi.org/10.5281/zenodo.8360812). 2. Open the zip file with the zip utlity on your machine and save the folder and files to a location where you can easily find them. For example, your Desktop. 3. Contained in the zip file are two files, doaj-article-sample.db and doaj-article-sample.db.sql. You can either open the database file (less steps) or import the SQL file (more steps).