Skip to content

Commit

Permalink
notes for sql continued
Browse files Browse the repository at this point in the history
  • Loading branch information
aparrish committed Aug 24, 2015
1 parent 143ad6e commit 8acff3e
Show file tree
Hide file tree
Showing 3 changed files with 1,093 additions and 8 deletions.
1 change: 1 addition & 0 deletions databases-2015/README.md
Expand Up @@ -207,6 +207,7 @@ Homework

##Week 7: August 24th and 26th

* SQL, continued. [Notes](SQL_notes_part2.md)
* Building web APIs with Flask (and/or other selected topics)
* Final project workshops

Expand Down
16 changes: 8 additions & 8 deletions databases-2015/SQL_notes.md
Expand Up @@ -9,7 +9,7 @@ to hold this information:

| name | title | start_year |
| ---- | ----- | ---------- |
| Gabriela McCullough | reporter | 2009 |
| Gabriella McCullough | reporter | 2009 |
| Steven Kennedy | drama critic | 2012 |
| Jalen Shaara | columnist | 2002 |

Expand Down Expand Up @@ -90,7 +90,7 @@ created above for our imaginary news organization:

| name | title | start_year |
| ---- | ----- | ---------- |
| Gabriela McCullough | reporter | 2009 |
| Gabriella McCullough | reporter | 2009 |
| Steven Kennedy | drama critic | 2012 |
| Jalen Shaara | columnist | 2002 |

Expand All @@ -112,15 +112,15 @@ The SQL commands for creating these tables in the database looks like this:
The SQL commands for populating those tables with data looks like this:

insert into reporters (name, title, start_year) values
('Gabriela McCullough', 'reporter', 2009),
('Gabriella McCullough', 'reporter', 2009),
('Steven Kennedy', 'drama critic', 2012),
('Jalen Shaara', 'columnist', 2002);

insert into articles (author, title, published_date) values
('Gabriela McCullough', 'Man, opossum reach garbage accord', '2015-07-01'),
('Gabriella McCullough', 'Man, opossum reach garbage accord', '2015-07-01'),
('Steven Kennedy', '"The Deceit of Apricot" opens to rave reviews', '2015-07-15'),
('Jalen Shaara', 'What''s the Big Data? Why I''m a data skeptic', '2015-07-16'),
('Gabriela McCullough', 'Traffic signals restored on Tunguska Ave', '2015-07-01');
('Gabriella McCullough', 'Traffic signals restored on Tunguska Ave', '2015-07-01');

Here are some example queries we can run on the data, along with their results.
To get a list just of reporter's names:
Expand All @@ -129,7 +129,7 @@ To get a list just of reporter's names:

name
---------------------
Gabriela McCullough
Gabriella McCullough
Steven Kennedy
Jalen Shaara

Expand All @@ -149,8 +149,8 @@ To get a list of articles and authors, along with the titles of those authors:

author | title | title
---------------------+--------------+-----------------------------------------------
Gabriela McCullough | reporter | Traffic signals restored on Tunguska Ave
Gabriela McCullough | reporter | Man, opossum reach garbage accord
Gabriella McCullough | reporter | Traffic signals restored on Tunguska Ave
Gabriella McCullough | reporter | Man, opossum reach garbage accord
Steven Kennedy | drama critic | "The Deceit of Apricot" opens to rave reviews
Jalen Shaara | columnist | What's the Big Data? Why I'm a data skeptic

Expand Down

0 comments on commit 8acff3e

Please sign in to comment.