Fixing data type error in SQL creation
[swc-sql.git] / sql / novice / guide.md
1 ---
2 layout: lesson
3 root: ../..
4 title: Instructor's Guide
5 level: novice
6 ---
7 Relational databases are not as widely used in science as in business,
8 but they are still a common way to store large data sets with complex structure.
9 Even when the data itself isn't in a database,
10 the metadata could be:
11 for example,
12 meteorological data might be stored in files on disk,
13 but data about when and where observations were made,
14 data ranges,
15 and so on could be in a database
16 to make it easier for scientists to find what they want to.
17
18 Teaching Notes
19 --------------
20
21 *   The first few sections (up to "Missing Data") usually go very quickly.
22     The pace usually slows down a bit when null values are discussed
23     mostly because learners have a lot of details to keep straight by this point.
24     Things *really* slow down during the discussion of joins,
25     but this is the key idea in the whole lesson:
26     important ideas like primary keys and referential integrity
27     only make sense once learners have seen how they're used in joins.
28     It's worth going over things a couple of times if necessary (with lots of examples).
29
30 *   The sections on creating and modifying data,
31     and programming with databases,
32     can be dropped if time is short.
33     Of the two,
34     people seem to care most about how to add data (which only takes a few minutes to demonstrate).
35
36
37 *   Overall,
38     this material takes three hours to present assuming that a short exercise is done with each topic.
39
40 *   Simple calculations are actually easier to do in a spreadsheet;
41     the advantages of using a database become clear as soon as filtering and joins are needed.
42     Instructors may therefore want to show a spreadsheet with the information from the four database tables
43     consolidated into a single sheet,
44     and demonstrate what's needed in both systems to answer questions like,
45     "What was the average radiation reading in 1931?"
46
47 *   Some learners may have heard that NoSQL databases
48     (i.e., ones that don't use the relational model)
49     are the next big thing,
50     and ask why we're not teaching those.
51     The answers are:
52     1.  Relational databases are far more widely used than NoSQL databases.
53     2.  We have far more experience with relational databases than with any other kind,
54         so we have a better idea of what to teach and how to teach it.
55     3.  NoSQL databases are as different from each other as they are from relational databases.
56         Until a leader emerges, it isn't clear *which* NoSQL database we should teach.
57
58 *   Run `sqlite3 survey.db < gen-survey-database.sql`
59     to re-create survey database before loading notebooks.