Skip to content

Commit

Permalink
Add callout, fix numbered list, add to authors. (#350)
Browse files Browse the repository at this point in the history
Formatting fixes:
    Add a proper callout box for information on multiple statements.
    Reorder instruction list so last statement appears with others, and so the numbering doesn't reset.
    Add myself to authors (from prior work).
  • Loading branch information
jd-foster authored Mar 15, 2023
1 parent e224ad9 commit b126ed3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Hilmar Lapp <[email protected]>
Ian Carroll <[email protected]>
Jaime Ashander <[email protected]>
James Allen <[email protected]>
James Foster <[email protected]>
Jethro Johnson <[email protected]>
Jin <[email protected]>
Jon Pipitone <[email protected]>
Expand Down
5 changes: 2 additions & 3 deletions _episodes/00-sql-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ follow these instructions:
7. Press **OK**, you should subsequently get a message that the table was imported.
9. Back on the Database Structure tab, you should now see the table listed. Right click on the table name and choose **Modify Table**, or click on the **Modify Table** button just under the tabs and above the table list.
10. Click **Save** if asked to save all pending changes.
11. In the center panel of the window that appears, set the data types for each field using the suggestions in the table below (this includes fields from the `plots` and `species` tables also):
11. In the center panel of the window that appears, set the data types for each field using the suggestions in the table below (this includes fields from the `plots` and `species` tables also).
12. Finally, click **OK** one more time to confirm the operation. Then click the **Write Changes** button to save the database.

| Field | Data Type | Motivation | Table(s) |
|-------------------|:---------------|----------------------------------------------------------------------------------|-------------------|
Expand All @@ -205,8 +206,6 @@ follow these instructions:
| weight | REAL | Field contains measured numerical data | surveys |
| year | INTEGER | Allows for meaningful arithmetic and comparisons | surveys |

12. Finally, click **OK** one more time to confirm the operation. Then click the **Write Changes** button to save the database.


> ## Challenge
>
Expand Down
17 changes: 10 additions & 7 deletions _episodes/01-sql-basic-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ Sometimes you don't want to see all the results, you just want to get a sense of

SELECT *
FROM surveys
LIMIT 10;
LIMIT 10;

### Unique values

If we want only the unique values so that we can quickly see what species have
been sampled we use `DISTINCT`
been sampled we use `DISTINCT`

SELECT DISTINCT species_id
FROM surveys;
Expand Down Expand Up @@ -112,7 +112,7 @@ Here, we only want the data since 2000:
WHERE year >= 2000;

If we used the `TEXT` data type for the year, the `WHERE` clause should
be `year >= '2000'`.
be `year >= '2000'`.

We can use more sophisticated conditions by combining tests
with `AND` and `OR`. For example, suppose we want the data on *Dipodomys merriami*
Expand All @@ -135,9 +135,9 @@ species codes `DM`, `DO`, and `DS`, we could combine the tests using OR:

> ## Challenge
>
> - Produce a table listing the data for all individuals in Plot 1
> - Produce a table listing the data for all individuals in Plot 1
> that weighed more than 75 grams, telling us the date, species id code, and weight
> (in kg).
> (in kg).
>
> > ## Solution
> > ~~~
Expand Down Expand Up @@ -250,10 +250,13 @@ The computer is basically doing this:
3. Displaying requested columns or expressions.

Clauses are written in a fixed order: `SELECT`, `FROM`, `WHERE`, then `ORDER
BY`.
BY`.

> ## Multiple statements
>
> It is possible to write a query as a single line, but for readability, we recommend to put each clause on its own line.
> The standard way to separate each SQL statement is with a semicolon. This allows more than one SQL statement to be executed together.
> The standard way to separate a whole SQL statement is with a semicolon. This allows more than one SQL statement to be executed together.
{: .discussion}

> ## Challenge
>
Expand Down

0 comments on commit b126ed3

Please sign in to comment.