forked from swcarpentry/sql-novice-survey
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path07-join.html
599 lines (599 loc) · 20.4 KB
/
07-join.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="generator" content="pandoc">
<title>Software Carpentry: Databases and SQL</title>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap-responsive.css" />
<link rel="stylesheet" type="text/css" href="css/swc.css" />
<link rel="stylesheet" type="text/css" href="css/swc-workshop-and-lesson.css" />
<link rel="stylesheet" type="text/css" href="css/lesson.css" />
<link rel="alternate" type="application/rss+xml" title="Software Carpentry Blog" href="http://software-carpentry.org/feed.xml"/>
<meta charset="UTF-8" />
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body class="lesson">
<div class="container container-full-width card">
<div class="banner">
<a href="http://software-carpentry.org" title="Software Carpentry">
<img alt="Software Carpentry banner" src="img/software-carpentry-banner.png" />
</a>
</div>
<div class="row-fluid">
<div class="span10 offset1">
<h1 class="title">Databases and SQL</h1>
<h2 class="subtitle">Combining Data</h2>
<div id="learning-objectives" class="objectives">
<h2>Learning Objectives</h2>
<ul>
<li>Explain the operation of a query that joins two tables.</li>
<li>Explain how to restrict the output of a query containing a join to only include meaningful combinations of values.</li>
<li>Write queries that join tables on equal keys.</li>
<li>Explain what primary and foreign keys are, and why they are useful.</li>
<li>Explain what atomic values are, and why database fields should only contain atomic values.</li>
</ul>
</div>
<p>In order to submit her data to a web site that aggregates historical meteorological data, Gina needs to format it as latitude, longitude, date, quantity, and reading. However, her latitudes and longitudes are in the <code>Site</code> table, while the dates of measurements are in the <code>Visited</code> table and the readings themselves are in the <code>Survey</code> table. She needs to combine these tables somehow.</p>
<p>The SQL command to do this is <code>join</code>. To see how it works, let's start by joining the <code>Site</code> and <code>Visited</code> tables:</p>
<pre class="sourceCode sql"><code class="sourceCode sql"><span class="kw">select</span> * <span class="kw">from</span> Site <span class="kw">join</span> Visited;</code></pre>
<table>
<thead>
<tr class="header">
<th align="left">name</th>
<th align="left">lat</th>
<th align="left">long</th>
<th align="left">ident</th>
<th align="left">site</th>
<th align="left">dated</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">DR-1</td>
<td align="left">-49.85</td>
<td align="left">-128.57</td>
<td align="left">619</td>
<td align="left">DR-1</td>
<td align="left">1927-02-08</td>
</tr>
<tr class="even">
<td align="left">DR-1</td>
<td align="left">-49.85</td>
<td align="left">-128.57</td>
<td align="left">622</td>
<td align="left">DR-1</td>
<td align="left">1927-02-10</td>
</tr>
<tr class="odd">
<td align="left">DR-1</td>
<td align="left">-49.85</td>
<td align="left">-128.57</td>
<td align="left">734</td>
<td align="left">DR-3</td>
<td align="left">1939-01-07</td>
</tr>
<tr class="even">
<td align="left">DR-1</td>
<td align="left">-49.85</td>
<td align="left">-128.57</td>
<td align="left">735</td>
<td align="left">DR-3</td>
<td align="left">1930-01-12</td>
</tr>
<tr class="odd">
<td align="left">DR-1</td>
<td align="left">-49.85</td>
<td align="left">-128.57</td>
<td align="left">751</td>
<td align="left">DR-3</td>
<td align="left">1930-02-26</td>
</tr>
<tr class="even">
<td align="left">DR-1</td>
<td align="left">-49.85</td>
<td align="left">-128.57</td>
<td align="left">752</td>
<td align="left">DR-3</td>
<td align="left">-null-</td>
</tr>
<tr class="odd">
<td align="left">DR-1</td>
<td align="left">-49.85</td>
<td align="left">-128.57</td>
<td align="left">837</td>
<td align="left">MSK-4</td>
<td align="left">1932-01-14</td>
</tr>
<tr class="even">
<td align="left">DR-1</td>
<td align="left">-49.85</td>
<td align="left">-128.57</td>
<td align="left">844</td>
<td align="left">DR-1</td>
<td align="left">1932-03-22</td>
</tr>
<tr class="odd">
<td align="left">DR-3</td>
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">619</td>
<td align="left">DR-1</td>
<td align="left">1927-02-08</td>
</tr>
<tr class="even">
<td align="left">DR-3</td>
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">622</td>
<td align="left">DR-1</td>
<td align="left">1927-02-10</td>
</tr>
<tr class="odd">
<td align="left">DR-3</td>
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">734</td>
<td align="left">DR-3</td>
<td align="left">1939-01-07</td>
</tr>
<tr class="even">
<td align="left">DR-3</td>
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">735</td>
<td align="left">DR-3</td>
<td align="left">1930-01-12</td>
</tr>
<tr class="odd">
<td align="left">DR-3</td>
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">751</td>
<td align="left">DR-3</td>
<td align="left">1930-02-26</td>
</tr>
<tr class="even">
<td align="left">DR-3</td>
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">752</td>
<td align="left">DR-3</td>
<td align="left">-null-</td>
</tr>
<tr class="odd">
<td align="left">DR-3</td>
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">837</td>
<td align="left">MSK-4</td>
<td align="left">1932-01-14</td>
</tr>
<tr class="even">
<td align="left">DR-3</td>
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">844</td>
<td align="left">DR-1</td>
<td align="left">1932-03-22</td>
</tr>
<tr class="odd">
<td align="left">MSK-4</td>
<td align="left">-48.87</td>
<td align="left">-123.4</td>
<td align="left">619</td>
<td align="left">DR-1</td>
<td align="left">1927-02-08</td>
</tr>
<tr class="even">
<td align="left">MSK-4</td>
<td align="left">-48.87</td>
<td align="left">-123.4</td>
<td align="left">622</td>
<td align="left">DR-1</td>
<td align="left">1927-02-10</td>
</tr>
<tr class="odd">
<td align="left">MSK-4</td>
<td align="left">-48.87</td>
<td align="left">-123.4</td>
<td align="left">734</td>
<td align="left">DR-3</td>
<td align="left">1939-01-07</td>
</tr>
<tr class="even">
<td align="left">MSK-4</td>
<td align="left">-48.87</td>
<td align="left">-123.4</td>
<td align="left">735</td>
<td align="left">DR-3</td>
<td align="left">1930-01-12</td>
</tr>
<tr class="odd">
<td align="left">MSK-4</td>
<td align="left">-48.87</td>
<td align="left">-123.4</td>
<td align="left">751</td>
<td align="left">DR-3</td>
<td align="left">1930-02-26</td>
</tr>
<tr class="even">
<td align="left">MSK-4</td>
<td align="left">-48.87</td>
<td align="left">-123.4</td>
<td align="left">752</td>
<td align="left">DR-3</td>
<td align="left">-null-</td>
</tr>
<tr class="odd">
<td align="left">MSK-4</td>
<td align="left">-48.87</td>
<td align="left">-123.4</td>
<td align="left">837</td>
<td align="left">MSK-4</td>
<td align="left">1932-01-14</td>
</tr>
<tr class="even">
<td align="left">MSK-4</td>
<td align="left">-48.87</td>
<td align="left">-123.4</td>
<td align="left">844</td>
<td align="left">DR-1</td>
<td align="left">1932-03-22</td>
</tr>
</tbody>
</table>
<p><code>join</code> creates the <a href="reference.html#cross-product">cross product</a> of two tables, i.e., it joins each record of one with each record of the other to give all possible combinations. Since there are three records in <code>Site</code> and eight in <code>Visited</code>, the join's output has 24 records (3 * 8 = 24) . And since each table has three fields, the output has six fields (3 + 3 = 6).</p>
<p>What the join <em>hasn't</em> done is figure out if the records being joined have anything to do with each other. It has no way of knowing whether they do or not until we tell it how. To do that, we add a clause specifying that we're only interested in combinations that have the same site name, thus we need to use a filter:</p>
<pre class="sourceCode sql"><code class="sourceCode sql"><span class="kw">select</span> * <span class="kw">from</span> Site <span class="kw">join</span> Visited <span class="kw">on</span> Site.name=Visited.site;</code></pre>
<table>
<thead>
<tr class="header">
<th align="left">name</th>
<th align="left">lat</th>
<th align="left">long</th>
<th align="left">ident</th>
<th align="left">site</th>
<th align="left">dated</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">DR-1</td>
<td align="left">-49.85</td>
<td align="left">-128.57</td>
<td align="left">619</td>
<td align="left">DR-1</td>
<td align="left">1927-02-08</td>
</tr>
<tr class="even">
<td align="left">DR-1</td>
<td align="left">-49.85</td>
<td align="left">-128.57</td>
<td align="left">622</td>
<td align="left">DR-1</td>
<td align="left">1927-02-10</td>
</tr>
<tr class="odd">
<td align="left">DR-1</td>
<td align="left">-49.85</td>
<td align="left">-128.57</td>
<td align="left">844</td>
<td align="left">DR-1</td>
<td align="left">1932-03-22</td>
</tr>
<tr class="even">
<td align="left">DR-3</td>
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">734</td>
<td align="left">DR-3</td>
<td align="left">1939-01-07</td>
</tr>
<tr class="odd">
<td align="left">DR-3</td>
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">735</td>
<td align="left">DR-3</td>
<td align="left">1930-01-12</td>
</tr>
<tr class="even">
<td align="left">DR-3</td>
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">751</td>
<td align="left">DR-3</td>
<td align="left">1930-02-26</td>
</tr>
<tr class="odd">
<td align="left">DR-3</td>
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">752</td>
<td align="left">DR-3</td>
<td align="left">-null-</td>
</tr>
<tr class="even">
<td align="left">MSK-4</td>
<td align="left">-48.87</td>
<td align="left">-123.4</td>
<td align="left">837</td>
<td align="left">MSK-4</td>
<td align="left">1932-01-14</td>
</tr>
</tbody>
</table>
<p><code>on</code> does the same job as <code>where</code>: it only keeps records that pass some test. (The difference between the two is that <code>on</code> filters records as they're being created, while <code>where</code> waits until the join is done and then does the filtering.) Once we add this to our query, the database manager throws away records that combined information about two different sites, leaving us with just the ones we want.</p>
<p>Notice that we used <code>table.field</code> to specify field names in the output of the join. We do this because tables can have fields with the same name, and we need to be specific which ones we're talking about. For example, if we joined the <code>person</code> and <code>visited</code> tables, the result would inherit a field called <code>ident</code> from each of the original tables.</p>
<p>We can now use the same dotted notation to select the three columns we actually want out of our join:</p>
<pre class="sourceCode sql"><code class="sourceCode sql"><span class="kw">select</span> Site.lat, Site.long, Visited.dated
<span class="kw">from</span> Site <span class="kw">join</span> Visited
<span class="kw">on</span> Site.name=Visited.site;</code></pre>
<table>
<thead>
<tr class="header">
<th align="left">lat</th>
<th align="left">long</th>
<th align="left">dated</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">-49.85</td>
<td align="left">-128.57</td>
<td align="left">1927-02-08</td>
</tr>
<tr class="even">
<td align="left">-49.85</td>
<td align="left">-128.57</td>
<td align="left">1927-02-10</td>
</tr>
<tr class="odd">
<td align="left">-49.85</td>
<td align="left">-128.57</td>
<td align="left">1932-03-22</td>
</tr>
<tr class="even">
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">-null-</td>
</tr>
<tr class="odd">
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">1930-01-12</td>
</tr>
<tr class="even">
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">1930-02-26</td>
</tr>
<tr class="odd">
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">1939-01-07</td>
</tr>
<tr class="even">
<td align="left">-48.87</td>
<td align="left">-123.4</td>
<td align="left">1932-01-14</td>
</tr>
</tbody>
</table>
<p>If joining two tables is good, joining many tables must be better. In fact, we can join any number of tables simply by adding more <code>join</code> clauses to our query, and more <code>on</code> tests to filter out combinations of records that don't make sense:</p>
<pre class="sourceCode sql"><code class="sourceCode sql"><span class="kw">select</span> Site.lat, Site.long, Visited.dated, Survey.quant, Survey.reading
<span class="kw">from</span> Site <span class="kw">join</span> Visited <span class="kw">join</span> Survey
<span class="kw">on</span> Site.name=Visited.site
<span class="kw">and</span> Visited.ident=Survey.taken
<span class="kw">and</span> Visited.dated <span class="kw">is</span> <span class="kw">not</span> <span class="kw">null</span>;</code></pre>
<table>
<thead>
<tr class="header">
<th align="left">lat</th>
<th align="left">long</th>
<th align="left">dated</th>
<th align="left">quant</th>
<th align="left">reading</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">-49.85</td>
<td align="left">-128.57</td>
<td align="left">1927-02-08</td>
<td align="left">rad</td>
<td align="left">9.82</td>
</tr>
<tr class="even">
<td align="left">-49.85</td>
<td align="left">-128.57</td>
<td align="left">1927-02-08</td>
<td align="left">sal</td>
<td align="left">0.13</td>
</tr>
<tr class="odd">
<td align="left">-49.85</td>
<td align="left">-128.57</td>
<td align="left">1927-02-10</td>
<td align="left">rad</td>
<td align="left">7.8</td>
</tr>
<tr class="even">
<td align="left">-49.85</td>
<td align="left">-128.57</td>
<td align="left">1927-02-10</td>
<td align="left">sal</td>
<td align="left">0.09</td>
</tr>
<tr class="odd">
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">1939-01-07</td>
<td align="left">rad</td>
<td align="left">8.41</td>
</tr>
<tr class="even">
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">1939-01-07</td>
<td align="left">sal</td>
<td align="left">0.05</td>
</tr>
<tr class="odd">
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">1939-01-07</td>
<td align="left">temp</td>
<td align="left">-21.5</td>
</tr>
<tr class="even">
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">1930-01-12</td>
<td align="left">rad</td>
<td align="left">7.22</td>
</tr>
<tr class="odd">
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">1930-01-12</td>
<td align="left">sal</td>
<td align="left">0.06</td>
</tr>
<tr class="even">
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">1930-01-12</td>
<td align="left">temp</td>
<td align="left">-26.0</td>
</tr>
<tr class="odd">
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">1930-02-26</td>
<td align="left">rad</td>
<td align="left">4.35</td>
</tr>
<tr class="even">
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">1930-02-26</td>
<td align="left">sal</td>
<td align="left">0.1</td>
</tr>
<tr class="odd">
<td align="left">-47.15</td>
<td align="left">-126.72</td>
<td align="left">1930-02-26</td>
<td align="left">temp</td>
<td align="left">-18.5</td>
</tr>
<tr class="even">
<td align="left">-48.87</td>
<td align="left">-123.4</td>
<td align="left">1932-01-14</td>
<td align="left">rad</td>
<td align="left">1.46</td>
</tr>
<tr class="odd">
<td align="left">-48.87</td>
<td align="left">-123.4</td>
<td align="left">1932-01-14</td>
<td align="left">sal</td>
<td align="left">0.21</td>
</tr>
<tr class="even">
<td align="left">-48.87</td>
<td align="left">-123.4</td>
<td align="left">1932-01-14</td>
<td align="left">sal</td>
<td align="left">22.5</td>
</tr>
<tr class="odd">
<td align="left">-49.85</td>
<td align="left">-128.57</td>
<td align="left">1932-03-22</td>
<td align="left">rad</td>
<td align="left">11.25</td>
</tr>
</tbody>
</table>
<p>We can tell which records from <code>Site</code>, <code>Visited</code>, and <code>Survey</code> correspond with each other because those tables contain <a href="reference.html#primary-key">primary keys</a> and foreign keys](reference.html#foreign-key). A primary key is a value, or combination of values, that uniquely identifies each record in a table. A foreign key is a value (or combination of values) from one table that identifies a unique record in another table. Another way of saying this is that a foreign key is the primary key of one table that appears in some other table. In our database, <code>Person.ident</code> is the primary key in the <code>Person</code> table, while <code>Survey.person</code> is a foreign key relating the <code>Survey</code> table's entries to entries in <code>Person</code>.</p>
<p>Most database designers believe that every table should have a well-defined primary key. They also believe that this key should be separate from the data itself, so that if we ever need to change the data, we only need to make one change in one place. One easy way to do this is to create an arbitrary, unique ID for each record as we add it to the database. This is actually very common: those IDs have names like "student numbers" and "patient numbers", and they almost always turn out to have originally been a unique record identifier in some database system or other. As the query below demonstrates, SQLite automatically numbers records as they're added to tables, and we can use those record numbers in queries:</p>
<pre class="sourceCode sql"><code class="sourceCode sql"><span class="kw">select</span> <span class="dt">rowid</span>, * <span class="kw">from</span> Person;</code></pre>
<table>
<thead>
<tr class="header">
<th align="left">rowid</th>
<th align="left">ident</th>
<th align="left">personal</th>
<th align="left">family</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">1</td>
<td align="left">dyer</td>
<td align="left">William</td>
<td align="left">Dyer</td>
</tr>
<tr class="even">
<td align="left">2</td>
<td align="left">pb</td>
<td align="left">Frank</td>
<td align="left">Pabodie</td>
</tr>
<tr class="odd">
<td align="left">3</td>
<td align="left">lake</td>
<td align="left">Anderson</td>
<td align="left">Lake</td>
</tr>
<tr class="even">
<td align="left">4</td>
<td align="left">roe</td>
<td align="left">Valentina</td>
<td align="left">Roerich</td>
</tr>
<tr class="odd">
<td align="left">5</td>
<td align="left">danforth</td>
<td align="left">Frank</td>
<td align="left">Danforth</td>
</tr>
</tbody>
</table>
<div id="listing-radiation-readings" class="challenge">
<h2>Listing Radiation Readings</h2>
<p>Write a query that lists all radiation readings from the DR-1 site.</p>
</div>
<div id="wheres-frank" class="challenge">
<h2>Where's Frank?</h2>
<p>Write a query that lists all sites visited by people named "Frank".</p>
</div>
<div id="reading-queries" class="challenge">
<h2>Reading Queries</h2>
<p>Describe in your own words what the following query produces:</p>
<pre class="sourceCode sql"><code class="sourceCode sql"><span class="kw">select</span> Site.name <span class="kw">from</span> Site <span class="kw">join</span> Visited
<span class="kw">on</span> Site.lat<-<span class="fl">49.0</span> <span class="kw">and</span> Site.name=Visited.site <span class="kw">and</span> Visited.dated>=<span class="st">'1932-00-00'</span>;</code></pre>
</div>
</div>
</div>
<div class="footer">
<a class="label swc-blue-bg" href="http://software-carpentry.org">Software Carpentry</a>
<a class="label swc-blue-bg" href="https://github.com/swcarpentry/sql-novice-survey">Source</a>
<a class="label swc-blue-bg" href="mailto:admin@software-carpentry.org">Contact</a>
<a class="label swc-blue-bg" href="LICENSE.html">License</a>
</div>
</div>
<!-- Javascript placed at the end of the document so the pages load faster -->
<script src="http://software-carpentry.org/v5/js/jquery-1.9.1.min.js"></script>
<script src="http://software-carpentry.org/v5/js/bootstrap/bootstrap.min.js"></script>
</body>
</html>