-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsql-quickly.html
More file actions
584 lines (544 loc) · 60.2 KB
/
Copy pathsql-quickly.html
File metadata and controls
584 lines (544 loc) · 60.2 KB
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
<!DOCTYPE html>
<html lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>6 SQL Quickly | Neotoma Paleoecology Manual v2.0</title>
<meta name="description" content="The manual for the Neotoma Paleoecology Database, including SQL and R code examples." />
<meta name="generator" content="bookdown 0.43 and GitBook 2.6.7" />
<meta property="og:title" content="6 SQL Quickly | Neotoma Paleoecology Manual v2.0" />
<meta property="og:type" content="book" />
<meta property="og:description" content="The manual for the Neotoma Paleoecology Database, including SQL and R code examples." />
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="6 SQL Quickly | Neotoma Paleoecology Manual v2.0" />
<meta name="twitter:description" content="The manual for the Neotoma Paleoecology Database, including SQL and R code examples." />
<meta name="author" content="Simon Goring" />
<meta name="date" content="2025-11-04" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="prev" href="searching-for-sites.html"/>
<link rel="next" href="database-design-concepts.html"/>
<script src="libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/fuse.js@6.4.6/dist/fuse.min.js"></script>
<link href="libs/gitbook-2.6.7/css/style.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-table.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-bookdown.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-highlight.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-search.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-fontsettings.css" rel="stylesheet" />
<link href="libs/gitbook-2.6.7/css/plugin-clipboard.css" rel="stylesheet" />
<link href="libs/anchor-sections-1.1.0/anchor-sections.css" rel="stylesheet" />
<link href="libs/anchor-sections-1.1.0/anchor-sections-hash.css" rel="stylesheet" />
<script src="libs/anchor-sections-1.1.0/anchor-sections.js"></script>
<link href="libs/htmltools-fill-0.5.8.1/fill.css" rel="stylesheet" />
<script src="libs/htmlwidgets-1.6.4/htmlwidgets.js"></script>
<link href="libs/leaflet-1.3.1/leaflet.css" rel="stylesheet" />
<script src="libs/leaflet-1.3.1/leaflet.js"></script>
<link href="libs/leafletfix-1.0.0/leafletfix.css" rel="stylesheet" />
<script src="libs/proj4-2.6.2/proj4.min.js"></script>
<script src="libs/Proj4Leaflet-1.0.1/proj4leaflet.js"></script>
<link href="libs/rstudio_leaflet-1.3.1/rstudio_leaflet.css" rel="stylesheet" />
<script src="libs/leaflet-binding-2.2.2/leaflet.js"></script>
<link href="libs/leaflet-markercluster-1.0.5/MarkerCluster.css" rel="stylesheet" />
<link href="libs/leaflet-markercluster-1.0.5/MarkerCluster.Default.css" rel="stylesheet" />
<script src="libs/leaflet-markercluster-1.0.5/leaflet.markercluster.js"></script>
<script src="libs/leaflet-markercluster-1.0.5/leaflet.markercluster.freezable.js"></script>
<script src="libs/leaflet-markercluster-1.0.5/leaflet.markercluster.layersupport.js"></script>
<link href="libs/datatables-css-0.0.0/datatables-crosstalk.css" rel="stylesheet" />
<script src="libs/datatables-binding-0.33/datatables.js"></script>
<link href="libs/dt-core-1.13.6/css/jquery.dataTables.min.css" rel="stylesheet" />
<link href="libs/dt-core-1.13.6/css/jquery.dataTables.extra.css" rel="stylesheet" />
<script src="libs/dt-core-1.13.6/js/jquery.dataTables.min.js"></script>
<link href="libs/crosstalk-1.2.1/css/crosstalk.min.css" rel="stylesheet" />
<script src="libs/crosstalk-1.2.1/js/crosstalk.min.js"></script>
<style type="text/css">
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { display: inline-block; text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { color: #008000; } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { color: #008000; font-weight: bold; } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>
<style type="text/css">
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
</style>
<style type="text/css">
/* Used with Pandoc 2.11+ new --citeproc when CSL is used */
div.csl-bib-body { }
div.csl-entry {
clear: both;
margin-bottom: 0em;
}
.hanging div.csl-entry {
margin-left:2em;
text-indent:-2em;
}
div.csl-left-margin {
min-width:2em;
float:left;
}
div.csl-right-inline {
margin-left:2em;
padding-left:1em;
}
div.csl-indent {
margin-left: 2em;
}
</style>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div class="book without-animation with-summary font-size-2 font-family-1" data-basepath=".">
<div class="book-summary">
<nav role="navigation">
<ul class="summary">
<li class="chapter" data-level="1" data-path="index.html"><a href="index.html"><i class="fa fa-check"></i><b>1</b> Acknowledgements</a></li>
<li class="chapter" data-level="2" data-path="introduction.html"><a href="introduction.html"><i class="fa fa-check"></i><b>2</b> Introduction</a>
<ul>
<li class="chapter" data-level="2.1" data-path="introduction.html"><a href="introduction.html#whence-neotoma"><i class="fa fa-check"></i><b>2.1</b> Whence Neotoma</a></li>
<li class="chapter" data-level="2.2" data-path="introduction.html"><a href="introduction.html#rationale"><i class="fa fa-check"></i><b>2.2</b> Rationale</a></li>
<li class="chapter" data-level="2.3" data-path="introduction.html"><a href="introduction.html#history-of-the-constituent-databases"><i class="fa fa-check"></i><b>2.3</b> History of the Constituent Databases</a>
<ul>
<li class="chapter" data-level="2.3.1" data-path="introduction.html"><a href="introduction.html#global-pollen-database"><i class="fa fa-check"></i><b>2.3.1</b> Global Pollen Database</a></li>
<li class="chapter" data-level="2.3.2" data-path="introduction.html"><a href="introduction.html#north-american-plant-macrofossil-database"><i class="fa fa-check"></i><b>2.3.2</b> North American Plant Macrofossil Database</a></li>
<li class="chapter" data-level="2.3.3" data-path="introduction.html"><a href="introduction.html#FAUNMAP"><i class="fa fa-check"></i><b>2.3.3</b> FAUNMAP</a></li>
<li class="chapter" data-level="2.3.4" data-path="introduction.html"><a href="introduction.html#BEETLE"><i class="fa fa-check"></i><b>2.3.4</b> BEETLE</a></li>
</ul></li>
<li class="chapter" data-level="2.4" data-path="introduction.html"><a href="introduction.html#who-will-use-neotoma"><i class="fa fa-check"></i><b>2.4</b> Who Will Use Neotoma?</a></li>
</ul></li>
<li class="chapter" data-level="3" data-path="working-with-the-raw-data.html"><a href="working-with-the-raw-data.html"><i class="fa fa-check"></i><b>3</b> Working with the Raw Data</a>
<ul>
<li class="chapter" data-level="3.1" data-path="working-with-the-raw-data.html"><a href="working-with-the-raw-data.html#using-the-database-locally"><i class="fa fa-check"></i><b>3.1</b> Using the Database Locally</a></li>
</ul></li>
<li class="chapter" data-level="4" data-path="using-r.html"><a href="using-r.html"><i class="fa fa-check"></i><b>4</b> Using R</a></li>
<li class="chapter" data-level="5" data-path="searching-for-sites.html"><a href="searching-for-sites.html"><i class="fa fa-check"></i><b>5</b> Searching for Sites</a>
<ul>
<li class="chapter" data-level="5.1" data-path="searching-for-sites.html"><a href="searching-for-sites.html#site-names-sitenamelago"><i class="fa fa-check"></i><b>5.1</b> Site names: <code>sitename="%Lago%"</code></a>
<ul>
<li class="chapter" data-level="5.1.1" data-path="searching-for-sites.html"><a href="searching-for-sites.html#code"><i class="fa fa-check"></i><b>5.1.1</b> Code</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="6" data-path="sql-quickly.html"><a href="sql-quickly.html"><i class="fa fa-check"></i><b>6</b> SQL Quickly</a>
<ul>
<li class="chapter" data-level="6.1" data-path="sql-quickly.html"><a href="sql-quickly.html#sql-example"><i class="fa fa-check"></i><b>6.1</b> SQL Example</a>
<ul>
<li class="chapter" data-level="6.1.1" data-path="sql-quickly.html"><a href="sql-quickly.html#sql-query"><i class="fa fa-check"></i><b>6.1.1</b> SQL Query</a></li>
</ul></li>
<li class="chapter" data-level="6.2" data-path="sql-quickly.html"><a href="sql-quickly.html#table-keys"><i class="fa fa-check"></i><b>6.2</b> Table Keys</a></li>
<li class="chapter" data-level="6.3" data-path="sql-quickly.html"><a href="sql-quickly.html#data-types"><i class="fa fa-check"></i><b>6.3</b> Data Types</a>
<ul>
<li class="chapter" data-level="6.3.1" data-path="sql-quickly.html"><a href="sql-quickly.html#query"><i class="fa fa-check"></i><b>6.3.1</b> Query</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="7" data-path="database-design-concepts.html"><a href="database-design-concepts.html"><i class="fa fa-check"></i><b>7</b> Database Design Concepts</a>
<ul>
<li class="chapter" data-level="7.1" data-path="database-design-concepts.html"><a href="database-design-concepts.html#sitedesign"><i class="fa fa-check"></i><b>7.1</b> Sites, Collection Units, Analysis Units, Samples, and Datasets</a></li>
<li class="chapter" data-level="7.2" data-path="database-design-concepts.html"><a href="database-design-concepts.html#taxa-and-variables"><i class="fa fa-check"></i><b>7.2</b> Taxa and Variables</a></li>
<li class="chapter" data-level="7.3" data-path="database-design-concepts.html"><a href="database-design-concepts.html#taxonomy-and-synonymy"><i class="fa fa-check"></i><b>7.3</b> Taxonomy and Synonymy</a></li>
<li class="chapter" data-level="7.4" data-path="database-design-concepts.html"><a href="database-design-concepts.html#taxa-and-ecological-groups"><i class="fa fa-check"></i><b>7.4</b> Taxa and Ecological Groups</a></li>
<li class="chapter" data-level="7.5" data-path="database-design-concepts.html"><a href="database-design-concepts.html#chronology"><i class="fa fa-check"></i><b>7.5</b> Chronology</a></li>
<li class="chapter" data-level="7.6" data-path="database-design-concepts.html"><a href="database-design-concepts.html#sediment-and-depositional-environments"><i class="fa fa-check"></i><b>7.6</b> Sediment and Depositional Environments</a></li>
<li class="chapter" data-level="7.7" data-path="database-design-concepts.html"><a href="database-design-concepts.html#date-fields"><i class="fa fa-check"></i><b>7.7</b> Date Fields</a></li>
</ul></li>
<li class="chapter" data-level="8" data-path="neotoma-tables.html"><a href="neotoma-tables.html"><i class="fa fa-check"></i><b>8</b> Neotoma Tables</a>
<ul>
<li class="chapter" data-level="8.1" data-path="neotoma-tables.html"><a href="neotoma-tables.html#site-related-tables"><i class="fa fa-check"></i><b>8.1</b> Site Related Tables</a></li>
<li class="chapter" data-level="8.2" data-path="neotoma-tables.html"><a href="neotoma-tables.html#dataset-collection-related-tables"><i class="fa fa-check"></i><b>8.2</b> Dataset & Collection Related Tables</a></li>
<li class="chapter" data-level="8.3" data-path="neotoma-tables.html"><a href="neotoma-tables.html#chronology-age-related-tables"><i class="fa fa-check"></i><b>8.3</b> Chronology & Age Related Tables</a></li>
<li class="chapter" data-level="8.4" data-path="neotoma-tables.html"><a href="neotoma-tables.html#sample-related-tables"><i class="fa fa-check"></i><b>8.4</b> Sample Related Tables</a></li>
<li class="chapter" data-level="8.5" data-path="neotoma-tables.html"><a href="neotoma-tables.html#specimen-related-tables"><i class="fa fa-check"></i><b>8.5</b> Specimen Related Tables</a></li>
<li class="chapter" data-level="8.6" data-path="neotoma-tables.html"><a href="neotoma-tables.html#taxonomy-related-tables"><i class="fa fa-check"></i><b>8.6</b> Taxonomy Related Tables</a></li>
<li class="chapter" data-level="8.7" data-path="neotoma-tables.html"><a href="neotoma-tables.html#individual-related-tables"><i class="fa fa-check"></i><b>8.7</b> Individual Related Tables</a></li>
<li class="chapter" data-level="8.8" data-path="neotoma-tables.html"><a href="neotoma-tables.html#publication-related-tables"><i class="fa fa-check"></i><b>8.8</b> Publication Related Tables</a></li>
<li class="chapter" data-level="8.9" data-path="neotoma-tables.html"><a href="neotoma-tables.html#supporting-resources"><i class="fa fa-check"></i><b>8.9</b> Supporting Resources</a></li>
<li class="chapter" data-level="8.10" data-path="neotoma-tables.html"><a href="neotoma-tables.html#isotope-data-management"><i class="fa fa-check"></i><b>8.10</b> Isotope Data Management</a></li>
</ul></li>
<li class="chapter" data-level="9" data-path="contact-and-individual-related-tables.html"><a href="contact-and-individual-related-tables.html"><i class="fa fa-check"></i><b>9</b> Contact and Individual Related Tables</a>
<ul>
<li class="chapter" data-level="9.1" data-path="contact-and-individual-related-tables.html"><a href="contact-and-individual-related-tables.html#Collectors"><i class="fa fa-check"></i><b>9.1</b> <code>collectors</code></a>
<ul>
<li class="chapter" data-level="9.1.1" data-path="contact-and-individual-related-tables.html"><a href="contact-and-individual-related-tables.html#sql-example-1"><i class="fa fa-check"></i><b>9.1.1</b> SQL Example</a></li>
</ul></li>
<li class="chapter" data-level="9.2" data-path="contact-and-individual-related-tables.html"><a href="contact-and-individual-related-tables.html#Contacts"><i class="fa fa-check"></i><b>9.2</b> <code>contacts</code></a></li>
<li class="chapter" data-level="9.3" data-path="contact-and-individual-related-tables.html"><a href="contact-and-individual-related-tables.html#ContactStatuses"><i class="fa fa-check"></i><b>9.3</b> <code>contactstatuses</code></a></li>
</ul></li>
<li class="chapter" data-level="10" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html"><i class="fa fa-check"></i><b>10</b> Dataset & Collection Related Tables</a>
<ul>
<li class="chapter" data-level="10.1" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#accumulationrates"><i class="fa fa-check"></i><b>10.1</b> <code>accumulationrates</code></a></li>
<li class="chapter" data-level="10.2" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#AggregateDatasets"><i class="fa fa-check"></i><b>10.2</b> <code>aggregatedatasets</code></a></li>
<li class="chapter" data-level="10.3" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#AggregateOrderTypes"><i class="fa fa-check"></i><b>10.3</b> <code>aggregateordertypes</code></a></li>
<li class="chapter" data-level="10.4" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#CollectionTypes"><i class="fa fa-check"></i><b>10.4</b> <code>collectiontypes</code></a></li>
<li class="chapter" data-level="10.5" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#CollectionUnits"><i class="fa fa-check"></i><b>10.5</b> <code>collectionunits</code></a></li>
<li class="chapter" data-level="10.6" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#contextsdatasettypes"><i class="fa fa-check"></i><b>10.6</b> <code>contextsdatasettypes</code></a></li>
<li class="chapter" data-level="10.7" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#datasetdatabases"><i class="fa fa-check"></i><b>10.7</b> <code>datasetdatabases</code></a></li>
<li class="chapter" data-level="10.8" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#datasetdoi"><i class="fa fa-check"></i><b>10.8</b> <code>datasetdoi</code></a></li>
<li class="chapter" data-level="10.9" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#DatasetPIs"><i class="fa fa-check"></i><b>10.9</b> <code>datasetpis</code></a></li>
<li class="chapter" data-level="10.10" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#DatasetPublications"><i class="fa fa-check"></i><b>10.10</b> <code>datasetpublications</code></a></li>
<li class="chapter" data-level="10.11" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#Datasets"><i class="fa fa-check"></i><b>10.11</b> <code>datasets</code></a>
<ul>
<li class="chapter" data-level="10.11.1" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#sql-example-2"><i class="fa fa-check"></i><b>10.11.1</b> SQL Example</a></li>
<li class="chapter" data-level="10.11.2" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#sql-example-3"><i class="fa fa-check"></i><b>10.11.2</b> SQL Example</a></li>
</ul></li>
<li class="chapter" data-level="10.12" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#DatasetSubmissions"><i class="fa fa-check"></i><b>10.12</b> <code>datasetsubmissions</code></a></li>
<li class="chapter" data-level="10.13" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#DatasetSubmissionTypes"><i class="fa fa-check"></i><b>10.13</b> <code>datasetsubmissiontypes</code></a>
<ul>
<li class="chapter" data-level="10.13.1" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#sql-example-4"><i class="fa fa-check"></i><b>10.13.1</b> SQL Example</a></li>
</ul></li>
<li class="chapter" data-level="10.14" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#datasettaxagrouptypes"><i class="fa fa-check"></i><b>10.14</b> <code>datasettaxagrouptypes</code></a></li>
<li class="chapter" data-level="10.15" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#datasettaxonnotes"><i class="fa fa-check"></i><b>10.15</b> <code>datasettaxonnotes</code></a></li>
<li class="chapter" data-level="10.16" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#DatasetTypes"><i class="fa fa-check"></i><b>10.16</b> <code>datasettypes</code></a></li>
<li class="chapter" data-level="10.17" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#datasetvariables"><i class="fa fa-check"></i><b>10.17</b> <code>datasetvariables</code></a></li>
<li class="chapter" data-level="10.18" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#DepEnvtTypes"><i class="fa fa-check"></i><b>10.18</b> <code>depenvttypes</code></a>
<ul>
<li class="chapter" data-level="10.18.1" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#sql-example-5"><i class="fa fa-check"></i><b>10.18.1</b> SQL Example</a></li>
<li class="chapter" data-level="10.18.2" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#sql-example-6"><i class="fa fa-check"></i><b>10.18.2</b> SQL Example</a></li>
<li class="chapter" data-level="10.18.3" data-path="dataset-collection-related-tables-1.html"><a href="dataset-collection-related-tables-1.html#sql-example-7"><i class="fa fa-check"></i><b>10.18.3</b> SQL Example</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="11" data-path="publication-related-tables-1.html"><a href="publication-related-tables-1.html"><i class="fa fa-check"></i><b>11</b> Publication Related Tables</a>
<ul>
<li class="chapter" data-level="11.1" data-path="publication-related-tables-1.html"><a href="publication-related-tables-1.html#publicationauthors"><i class="fa fa-check"></i><b>11.1</b> <code>publicationauthors</code></a>
<ul>
<li class="chapter" data-level="11.1.1" data-path="publication-related-tables-1.html"><a href="publication-related-tables-1.html#sql-example-8"><i class="fa fa-check"></i><b>11.1.1</b> SQL Example</a></li>
</ul></li>
<li class="chapter" data-level="11.2" data-path="publication-related-tables-1.html"><a href="publication-related-tables-1.html#publicationeditors"><i class="fa fa-check"></i><b>11.2</b> <code>publicationeditors</code></a></li>
<li class="chapter" data-level="11.3" data-path="publication-related-tables-1.html"><a href="publication-related-tables-1.html#Publications"><i class="fa fa-check"></i><b>11.3</b> <code>publications</code></a></li>
<li class="chapter" data-level="11.4" data-path="publication-related-tables-1.html"><a href="publication-related-tables-1.html#PublicationTypes"><i class="fa fa-check"></i><b>11.4</b> <code>publicationtypes</code></a>
<ul>
<li class="chapter" data-level="11.4.1" data-path="publication-related-tables-1.html"><a href="publication-related-tables-1.html#legacy"><i class="fa fa-check"></i><b>11.4.1</b> Legacy</a></li>
<li class="chapter" data-level="11.4.2" data-path="publication-related-tables-1.html"><a href="publication-related-tables-1.html#journal-article"><i class="fa fa-check"></i><b>11.4.2</b> Journal Article</a></li>
<li class="chapter" data-level="11.4.3" data-path="publication-related-tables-1.html"><a href="publication-related-tables-1.html#book-chapter"><i class="fa fa-check"></i><b>11.4.3</b> Book Chapter</a></li>
<li class="chapter" data-level="11.4.4" data-path="publication-related-tables-1.html"><a href="publication-related-tables-1.html#authored-book"><i class="fa fa-check"></i><b>11.4.4</b> Authored Book</a></li>
<li class="chapter" data-level="11.4.5" data-path="publication-related-tables-1.html"><a href="publication-related-tables-1.html#edited-book"><i class="fa fa-check"></i><b>11.4.5</b> Edited Book</a></li>
<li class="chapter" data-level="11.4.6" data-path="publication-related-tables-1.html"><a href="publication-related-tables-1.html#masters-thesis"><i class="fa fa-check"></i><b>11.4.6</b> Master’s Thesis</a></li>
<li class="chapter" data-level="11.4.7" data-path="publication-related-tables-1.html"><a href="publication-related-tables-1.html#doctoral-dissertation"><i class="fa fa-check"></i><b>11.4.7</b> Doctoral Dissertation</a></li>
<li class="chapter" data-level="11.4.8" data-path="publication-related-tables-1.html"><a href="publication-related-tables-1.html#authored-report"><i class="fa fa-check"></i><b>11.4.8</b> Authored Report</a></li>
<li class="chapter" data-level="11.4.9" data-path="publication-related-tables-1.html"><a href="publication-related-tables-1.html#edited-report"><i class="fa fa-check"></i><b>11.4.9</b> Edited Report</a></li>
<li class="chapter" data-level="11.4.10" data-path="publication-related-tables-1.html"><a href="publication-related-tables-1.html#other-authored-publication"><i class="fa fa-check"></i><b>11.4.10</b> Other Authored Publication</a></li>
<li class="chapter" data-level="11.4.11" data-path="publication-related-tables-1.html"><a href="publication-related-tables-1.html#other-edited-publication"><i class="fa fa-check"></i><b>11.4.11</b> Other Edited Publication</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="12" data-path="sample-related-tables-1.html"><a href="sample-related-tables-1.html"><i class="fa fa-check"></i><b>12</b> Sample Related Tables</a>
<ul>
<li class="chapter" data-level="12.1" data-path="sample-related-tables-1.html"><a href="sample-related-tables-1.html#AggregateSamples"><i class="fa fa-check"></i><b>12.1</b> <code>aggregatesamples</code></a></li>
<li class="chapter" data-level="12.2" data-path="sample-related-tables-1.html"><a href="sample-related-tables-1.html#AnalysisUnits"><i class="fa fa-check"></i><b>12.2</b> <code>analysisunits</code></a></li>
<li class="chapter" data-level="12.3" data-path="sample-related-tables-1.html"><a href="sample-related-tables-1.html#Data"><i class="fa fa-check"></i><b>12.3</b> <code>data</code></a>
<ul>
<li class="chapter" data-level="12.3.1" data-path="sample-related-tables-1.html"><a href="sample-related-tables-1.html#sql-example-9"><i class="fa fa-check"></i><b>12.3.1</b> SQL Example</a></li>
</ul></li>
<li class="chapter" data-level="12.4" data-path="sample-related-tables-1.html"><a href="sample-related-tables-1.html#DepAgents"><i class="fa fa-check"></i><b>12.4</b> <code>depagents</code></a></li>
<li class="chapter" data-level="12.5" data-path="sample-related-tables-1.html"><a href="sample-related-tables-1.html#DepAgentTypes"><i class="fa fa-check"></i><b>12.5</b> <code>depagenttypes</code></a></li>
<li class="chapter" data-level="12.6" data-path="sample-related-tables-1.html"><a href="sample-related-tables-1.html#FaciesTypes"><i class="fa fa-check"></i><b>12.6</b> <code>faciestypes</code></a></li>
<li class="chapter" data-level="12.7" data-path="sample-related-tables-1.html"><a href="sample-related-tables-1.html#Keywords"><i class="fa fa-check"></i><b>12.7</b> <code>keywords</code></a></li>
<li class="chapter" data-level="12.8" data-path="sample-related-tables-1.html"><a href="sample-related-tables-1.html#Lithology"><i class="fa fa-check"></i><b>12.8</b> <code>lithology</code></a></li>
<li class="chapter" data-level="12.9" data-path="sample-related-tables-1.html"><a href="sample-related-tables-1.html#SampleAges"><i class="fa fa-check"></i><b>12.9</b> <code>sampleages</code></a>
<ul>
<li class="chapter" data-level="12.9.1" data-path="sample-related-tables-1.html"><a href="sample-related-tables-1.html#sql-example-10"><i class="fa fa-check"></i><b>12.9.1</b> SQL Example</a></li>
</ul></li>
<li class="chapter" data-level="12.10" data-path="sample-related-tables-1.html"><a href="sample-related-tables-1.html#SampleAnalysts"><i class="fa fa-check"></i><b>12.10</b> <code>sampleanalysts</code></a></li>
<li class="chapter" data-level="12.11" data-path="sample-related-tables-1.html"><a href="sample-related-tables-1.html#SampleKeywords"><i class="fa fa-check"></i><b>12.11</b> <code>samplekeywords</code></a>
<ul>
<li class="chapter" data-level="12.11.1" data-path="sample-related-tables-1.html"><a href="sample-related-tables-1.html#sql-example-11"><i class="fa fa-check"></i><b>12.11.1</b> SQL Example</a></li>
</ul></li>
<li class="chapter" data-level="12.12" data-path="sample-related-tables-1.html"><a href="sample-related-tables-1.html#Samples"><i class="fa fa-check"></i><b>12.12</b> <code>samples</code></a>
<ul>
<li class="chapter" data-level="12.12.1" data-path="sample-related-tables-1.html"><a href="sample-related-tables-1.html#sql-example-12"><i class="fa fa-check"></i><b>12.12.1</b> SQL Example</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="13" data-path="site-related-tables-1.html"><a href="site-related-tables-1.html"><i class="fa fa-check"></i><b>13</b> Site Related Tables</a>
<ul>
<li class="chapter" data-level="13.1" data-path="site-related-tables-1.html"><a href="site-related-tables-1.html#GeoPoliticalUnits"><i class="fa fa-check"></i><b>13.1</b> <code>geopoliticalunits</code></a>
<ul>
<li class="chapter" data-level="13.1.1" data-path="site-related-tables-1.html"><a href="site-related-tables-1.html#sql-example-13"><i class="fa fa-check"></i><b>13.1.1</b> SQL Example</a></li>
<li class="chapter" data-level="13.1.2" data-path="site-related-tables-1.html"><a href="site-related-tables-1.html#sql-example-14"><i class="fa fa-check"></i><b>13.1.2</b> SQL Example</a></li>
</ul></li>
<li class="chapter" data-level="13.2" data-path="site-related-tables-1.html"><a href="site-related-tables-1.html#lakeparameters"><i class="fa fa-check"></i><b>13.2</b> <code>lakeparameters</code></a>
<ul>
<li class="chapter" data-level="13.2.1" data-path="site-related-tables-1.html"><a href="site-related-tables-1.html#sql-example-15"><i class="fa fa-check"></i><b>13.2.1</b> SQL Example</a></li>
</ul></li>
<li class="chapter" data-level="13.3" data-path="site-related-tables-1.html"><a href="site-related-tables-1.html#lakeparametertypes"><i class="fa fa-check"></i><b>13.3</b> <code>lakeparametertypes</code></a>
<ul>
<li class="chapter" data-level="13.3.1" data-path="site-related-tables-1.html"><a href="site-related-tables-1.html#sql-example-16"><i class="fa fa-check"></i><b>13.3.1</b> SQL Example</a></li>
</ul></li>
<li class="chapter" data-level="13.4" data-path="site-related-tables-1.html"><a href="site-related-tables-1.html#SiteGeoPolitical"><i class="fa fa-check"></i><b>13.4</b> <code>sitegeopolitical</code></a>
<ul>
<li class="chapter" data-level="13.4.1" data-path="site-related-tables-1.html"><a href="site-related-tables-1.html#sql-example-17"><i class="fa fa-check"></i><b>13.4.1</b> SQL Example</a></li>
</ul></li>
<li class="chapter" data-level="13.5" data-path="site-related-tables-1.html"><a href="site-related-tables-1.html#SiteImages"><i class="fa fa-check"></i><b>13.5</b> <code>siteimages</code></a></li>
<li class="chapter" data-level="13.6" data-path="site-related-tables-1.html"><a href="site-related-tables-1.html#Sites"><i class="fa fa-check"></i><b>13.6</b> <code>sites</code></a>
<ul>
<li class="chapter" data-level="13.6.1" data-path="site-related-tables-1.html"><a href="site-related-tables-1.html#sql-example-18"><i class="fa fa-check"></i><b>13.6.1</b> SQL Example</a></li>
</ul></li>
</ul></li>
<li class="chapter" data-level="14" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html"><i class="fa fa-check"></i><b>14</b> Taxonomy Related Tables</a>
<ul>
<li class="chapter" data-level="14.1" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#ecolgroups"><i class="fa fa-check"></i><b>14.1</b> <code>ecolgroups</code></a>
<ul>
<li class="chapter" data-level="14.1.1" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#sql-example-19"><i class="fa fa-check"></i><b>14.1.1</b> SQL Example</a></li>
<li class="chapter" data-level="14.1.2" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#sql-example-20"><i class="fa fa-check"></i><b>14.1.2</b> SQL Example</a></li>
</ul></li>
<li class="chapter" data-level="14.2" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#EcolGroupTypes"><i class="fa fa-check"></i><b>14.2</b> <code>ecolgrouptypes</code></a></li>
<li class="chapter" data-level="14.3" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#EcolSetTypes"><i class="fa fa-check"></i><b>14.3</b> <code>ecolsettypes</code></a></li>
<li class="chapter" data-level="14.4" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#Synonyms"><i class="fa fa-check"></i><b>14.4</b> <code>synonyms</code></a></li>
<li class="chapter" data-level="14.5" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#SynonymTypes"><i class="fa fa-check"></i><b>14.5</b> <code>synonymtypes</code></a>
<ul>
<li class="chapter" data-level="14.5.1" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#sql-example-21"><i class="fa fa-check"></i><b>14.5.1</b> SQL Example</a></li>
</ul></li>
<li class="chapter" data-level="14.6" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#Taxa"><i class="fa fa-check"></i><b>14.6</b> <code>taxa</code></a></li>
<li class="chapter" data-level="14.7" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#TaxaGroupTypes"><i class="fa fa-check"></i><b>14.7</b> <code>taxagrouptypes</code></a></li>
<li class="chapter" data-level="14.8" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#Variables"><i class="fa fa-check"></i><b>14.8</b> <code>variables</code></a>
<ul>
<li class="chapter" data-level="14.8.1" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#sql-example-22"><i class="fa fa-check"></i><b>14.8.1</b> SQL Example</a></li>
<li class="chapter" data-level="14.8.2" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#sql-example-23"><i class="fa fa-check"></i><b>14.8.2</b> SQL Example</a></li>
<li class="chapter" data-level="14.8.3" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#sql-example-24"><i class="fa fa-check"></i><b>14.8.3</b> SQL Example</a></li>
</ul></li>
<li class="chapter" data-level="14.9" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#VariableContexts"><i class="fa fa-check"></i><b>14.9</b> <code>variablecontexts</code></a></li>
<li class="chapter" data-level="14.10" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#VariableElements"><i class="fa fa-check"></i><b>14.10</b> <code>variableelements</code></a></li>
<li class="chapter" data-level="14.11" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#VariableModifications"><i class="fa fa-check"></i><b>14.11</b> <code>variablemodifications</code></a></li>
<li class="chapter" data-level="14.12" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#VariableUnits"><i class="fa fa-check"></i><b>14.12</b> <code>variableunits</code></a></li>
<li class="chapter" data-level="14.13" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#RepositoryInstitutions"><i class="fa fa-check"></i><b>14.13</b> <code>repositoryinstitutions</code></a></li>
<li class="chapter" data-level="14.14" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#RepositorySpecimens"><i class="fa fa-check"></i><b>14.14</b> <code>repositoryspecimens</code></a>
<ul>
<li class="chapter" data-level="14.14.1" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#sql-example-25"><i class="fa fa-check"></i><b>14.14.1</b> SQL Example</a></li>
</ul></li>
<li class="chapter" data-level="14.15" data-path="taxonomy-related-tables-1.html"><a href="taxonomy-related-tables-1.html#SpecimenDates"><i class="fa fa-check"></i><b>14.15</b> <code>specimendates</code></a></li>
</ul></li>
<li class="chapter" data-level="15" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html"><i class="fa fa-check"></i><b>15</b> Chronology & Age Related Tables</a>
<ul>
<li class="chapter" data-level="15.1" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#AgeTypes"><i class="fa fa-check"></i><b>15.1</b> <code>agetypes</code></a></li>
<li class="chapter" data-level="15.2" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#AggregateChronologies"><i class="fa fa-check"></i><b>15.2</b> <code>aggregatechronologies</code></a></li>
<li class="chapter" data-level="15.3" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#ChronControls"><i class="fa fa-check"></i><b>15.3</b> <code>chroncontrols</code></a></li>
<li class="chapter" data-level="15.4" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#ChronControlTypes"><i class="fa fa-check"></i><b>15.4</b> <code>chroncontroltypes</code></a></li>
<li class="chapter" data-level="15.5" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#Chronologies"><i class="fa fa-check"></i><b>15.5</b> <code>chronologies</code></a>
<ul>
<li class="chapter" data-level="15.5.1" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#sql-example-26"><i class="fa fa-check"></i><b>15.5.1</b> SQL Example</a></li>
<li class="chapter" data-level="15.5.2" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#sql-example-27"><i class="fa fa-check"></i><b>15.5.2</b> SQL Example</a></li>
</ul></li>
<li class="chapter" data-level="15.6" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#AggregateSampleAges"><i class="fa fa-check"></i><b>15.6</b> <code>aggregatesampleages</code></a>
<ul>
<li class="chapter" data-level="15.6.1" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#sql-example-28"><i class="fa fa-check"></i><b>15.6.1</b> SQL Example</a></li>
<li class="chapter" data-level="15.6.2" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#sql-example-29"><i class="fa fa-check"></i><b>15.6.2</b> SQL Example</a></li>
</ul></li>
<li class="chapter" data-level="15.7" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#Geochronology"><i class="fa fa-check"></i><b>15.7</b> <code>geochronology</code></a>
<ul>
<li class="chapter" data-level="15.7.1" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#sql-example-30"><i class="fa fa-check"></i><b>15.7.1</b> SQL Example</a></li>
</ul></li>
<li class="chapter" data-level="15.8" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#GeochronPublications"><i class="fa fa-check"></i><b>15.8</b> <code>geochronpublications</code></a></li>
<li class="chapter" data-level="15.9" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#GeochronTypes"><i class="fa fa-check"></i><b>15.9</b> <code>geochrontypes</code></a></li>
<li class="chapter" data-level="15.10" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#RelativeAgePublications"><i class="fa fa-check"></i><b>15.10</b> <code>relativeagepublications</code></a></li>
<li class="chapter" data-level="15.11" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#RelativeAges"><i class="fa fa-check"></i><b>15.11</b> <code>relativeages</code></a>
<ul>
<li class="chapter" data-level="15.11.1" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#sql-example-31"><i class="fa fa-check"></i><b>15.11.1</b> SQL Example</a></li>
</ul></li>
<li class="chapter" data-level="15.12" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#RadiocarbonCalibration"><i class="fa fa-check"></i><b>15.12</b> <code>radiocarboncalibration</code></a></li>
<li class="chapter" data-level="15.13" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#RelativeAgeScales"><i class="fa fa-check"></i><b>15.13</b> <code>relativeagescales</code></a></li>
<li class="chapter" data-level="15.14" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#RelativeAgeUnits"><i class="fa fa-check"></i><b>15.14</b> <code>relativeageunits</code></a></li>
<li class="chapter" data-level="15.15" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#RelativeChronology"><i class="fa fa-check"></i><b>15.15</b> <code>relativechronology</code></a></li>
<li class="chapter" data-level="15.16" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#Tephrachronology"><i class="fa fa-check"></i><b>15.16</b> <code>tephrachronology</code></a></li>
<li class="chapter" data-level="15.17" data-path="chronology-age-related-tables-1.html"><a href="chronology-age-related-tables-1.html#Tephras"><i class="fa fa-check"></i><b>15.17</b> <code>tephras</code></a></li>
</ul></li>
<li class="chapter" data-level="16" data-path="references.html"><a href="references.html"><i class="fa fa-check"></i><b>16</b> References</a></li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i><a href="./">Neotoma Paleoecology Manual v2.0</a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<section class="normal" id="section-">
<div id="sql-quickly" class="section level1 hasAnchor" number="6">
<h1><span class="header-section-number">6</span> SQL Quickly<a href="sql-quickly.html#sql-quickly" class="anchor-section" aria-label="Anchor link to header"></a></h1>
<p>SQL (Sturctured Query Language) is a standard language for querying and modifying relational databases. There is an official standard for SQL, which means that statements such as <code>SELECT</code> and <code>WHERE</code> are common across most SQL implementations. While many properties are common, individual vendors do maintain proprietary formatting. Neotoma is implemented using PostgreSQL, which has <a href="https://www.postgresql.org/docs/14/index.html">extensive documentation online</a>. It is beyond the scope of this document to teach SQL, however, we have included a large number of SQL queries along with the documentation to provide templates for queries, and to help the user understand how to directly work with the database. These queries can by typed or copied and pasted into database tools such as <a href="https://www.pgadmin.org/">pgAdmin</a>.</p>
<p>For the purposes of database development, the Neotoma team uses the following SQL tools:</p>
<ul>
<li><a href="https://www.pgadmin.org/">pgAdmin</a></li>
<li><a href="https://code.visualstudio.com/">VS Code</a></li>
<li><a href="https://www.postgresql.org/docs/current/app-psql.html">psql</a></li>
<li><a href="https://schemaspy.org/">SchemaSpy</a></li>
</ul>
<p>Throughout the Neotoma Database Manual we will refer to tables using the format <code>schema.tablename</code>. The <code>ndb</code> namespace is the schema for most of the data tables within the Neotoma database, so you will see things like <code>ndb.taxa</code> and <code>ndb.sites</code> frequently. There are other schema, including <code>apps</code>, <code>doi</code> and <code>public</code>, but the data tables themselves are kept in the <code>ndb</code> schema. You can see all available data tables in the <code>ndb</code> schema using the <a href="https://open.neotomadb.org/dbschema">Neotoma database schema website</a>.</p>
<div id="sql-example" class="section level2 hasAnchor" number="6.1">
<h2><span class="header-section-number">6.1</span> SQL Example<a href="sql-quickly.html#sql-example" class="anchor-section" aria-label="Anchor link to header"></a></h2>
<p>The following SQL example lists the number of sites by the geopolitical unit, where the geopolitical unit is a country. It uses three tables, <code>ndb.sites</code>, which contains <strong>site</strong> information, <code>ndb.geopoliticalunits</code>, which lists all geopolitical units (countries, provinces, towns, etc.), and a <code>JOIN</code> table, which helps to link the <code>ndb.sites</code> table to the <code>ndb.geopoliticalunits</code> table.</p>
<p>By convention, SQL first defines the output, using the <code>SELECT</code> statement. The <code>FROM</code> block is used to explain how the information is brought together, and the <code>WHERE</code> (and subsequent blocks) are meant to help filter and aggregate data as generated within the <code>FROM</code> block.</p>
<p>Throughput this document we will use <code>AS</code> statements to help us write our SQL queries neatly, and we will use <code>INNER JOIN</code> calls with <code>ON</code> statements, rather than <code>NATURAL INNER JOIN</code> calls. Using <code>AS</code> helps us create an alias so that we don’t have to write so much in our query. As much as possible we will use the same aliases for tables throughout this guide. For example, <code>FROM ndb.sites AS st</code> is commonly used, where <code>st</code> becomes the alias for the <code>ndb.sites</code> table, and stands in for it elsewhere in the query. Often you will see <code>gpu</code> used for <code>ndb.geopoliticalunits</code>, or <code>tx</code> for <code>ndb.taxa</code>. In Postgres SQL it is not necessary to use the term <code>AS</code> (we use it here to make the queries clearer for folks just learning how to use SQL), so it’s possible to see things like <code>ndb.sites st</code> in place of <code>ndb.sites AS st</code>.</p>
<p>The <code>NATURAL INNER JOIN</code> assumes that any columns with common names are used in a <code>JOIN</code>. Because Neotoma enforces naming consistency (in general) between <a href="#table-keys-table-keys">primary and foreign keys</a>, we ought to be able to perform <code>NATURAL</code> joins. However, a trigger on most Neotoma tables adds the columns <code>recdatecreated</code> and <code>recdatemodified</code> to almost all tables. For this reason we make it practice within SQL queries to be explicit about the joining columns.</p>
<p>The following example show the use of queries with and without <code>AS</code>:</p>
<div id="sql-query" class="section level3 hasAnchor" number="6.1.1">
<h3><span class="header-section-number">6.1.1</span> SQL Query<a href="sql-quickly.html#sql-query" class="anchor-section" aria-label="Anchor link to header"></a></h3>
<div class="sourceCode" id="cb15"><pre class="sourceCode sql"><code class="sourceCode sql"><span id="cb15-1"><a href="sql-quickly.html#cb15-1" tabindex="-1"></a><span class="kw">SELECT</span></span>
<span id="cb15-2"><a href="sql-quickly.html#cb15-2" tabindex="-1"></a> <span class="fu">COUNT</span>(<span class="op">*</span>) <span class="kw">AS</span> sites,</span>
<span id="cb15-3"><a href="sql-quickly.html#cb15-3" tabindex="-1"></a> gpu.geopoliticalname, </span>
<span id="cb15-4"><a href="sql-quickly.html#cb15-4" tabindex="-1"></a> gpu.geopoliticalunit</span>
<span id="cb15-5"><a href="sql-quickly.html#cb15-5" tabindex="-1"></a><span class="kw">FROM</span></span>
<span id="cb15-6"><a href="sql-quickly.html#cb15-6" tabindex="-1"></a> ndb.geopoliticalunits <span class="kw">AS</span> gpu</span>
<span id="cb15-7"><a href="sql-quickly.html#cb15-7" tabindex="-1"></a> <span class="kw">INNER</span> <span class="kw">JOIN</span> ndb.sitegeopolitical <span class="kw">AS</span> sgp <span class="kw">ON</span> sgp.geopoliticalid <span class="op">=</span> gpu.geopoliticalid</span>
<span id="cb15-8"><a href="sql-quickly.html#cb15-8" tabindex="-1"></a> <span class="kw">INNER</span> <span class="kw">JOIN</span> ndb.sites st <span class="kw">ON</span> st.siteid <span class="op">=</span> sgp.siteid</span>
<span id="cb15-9"><a href="sql-quickly.html#cb15-9" tabindex="-1"></a><span class="kw">WHERE</span> </span>
<span id="cb15-10"><a href="sql-quickly.html#cb15-10" tabindex="-1"></a> gpu.geopoliticalunit <span class="op">=</span> <span class="st">'country'</span></span>
<span id="cb15-11"><a href="sql-quickly.html#cb15-11" tabindex="-1"></a><span class="kw">GROUP</span> <span class="kw">BY</span></span>
<span id="cb15-12"><a href="sql-quickly.html#cb15-12" tabindex="-1"></a> gpu.geopoliticalid</span>
<span id="cb15-13"><a href="sql-quickly.html#cb15-13" tabindex="-1"></a><span class="kw">HAVING</span> <span class="fu">COUNT</span>(<span class="op">*</span>) <span class="op">></span> <span class="dv">0</span></span>
<span id="cb15-14"><a href="sql-quickly.html#cb15-14" tabindex="-1"></a><span class="kw">ORDER</span> <span class="kw">BY</span> sites <span class="kw">DESC</span>;</span></code></pre></div>
<div class="sourceCode" id="cb16"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb16-1"><a href="sql-quickly.html#cb16-1" tabindex="-1"></a>DT<span class="sc">::</span><span class="fu">datatable</span>(geopoliticalsort)</span></code></pre></div>
<div class="datatables html-widget html-fill-item" id="htmlwidget-6f041aed2c3a9ada3aa4" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-6f041aed2c3a9ada3aa4">{"x":{"filter":"none","vertical":false,"data":[["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"],[11747,7906,614,597,544,534,458,276,250,176,174,172,169,153,147,137,131,124,113,108,77,75,70,69,67,65,65,63,60,54,51,49,49,47,46,45,44,38,35,35,31,28,26,25,24,22,19,18,18,18,17,16,14,12,12,11,11,11,11,11,10,10,10,10,9,9,8,8,8,8,8,8,7,7,7,7,7,6,6,6,5,5,5,5,5,5,5,4,4,4,3,3,3,3,3,3,3,3,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],["United States","Canada","Japan","France","China","Netherlands","Russia","United Kingdom","Germany","Spain","Czech Republic","Switzerland","Ecuador","Korea, South","Mexico","Australia","Mongolia","Sweden","Peru","Italy","Portugal","Panama","Ireland","Poland","Romania","Turkey","Bolivia","Norway","Costa Rica","Colombia","Kyrgyzstan","Greece","Estonia","Austria","Finland","South Africa","Argentina","Brazil","Guatemala","Chile","Ukraine","Slovakia","Belarus","Jordan","Bulgaria","Iran","Tanzania","Belgium","Kenya","Hungary","Uganda","India","Israel","Fiji","Latvia","Belize","Georgia","Tunisia","Indonesia","Ethiopia","Luxembourg","Papua New Guinea","Morocco","Cameroon","Chad","Madagascar","New Zealand","Congo, Democratic Republic of the [Zaire]","Croatia","Lithuania","Burundi","Bahamas","Iceland","Senegal","Nigeria","Algeria","Namibia","Venezuela","Egypt","Denmark","Syria","Ghana","Kazakhstan","Macedonia","Oman","Congo, Republic of the","Lebanon","Benin","Vanuatu","Sudan","Andorra","Montenegro","Cyprus","Qatar","Dominican Republic","Rwanda","Malawi","Mauritius","Bosnia and Herzegovina","Serbia","Gabon","Yemen","Slovenia","Somalia","Tonga","Taiwan","Armenia","Bermuda","Turkmenistan","São Tomé and Príncipe","Cape Verde","Grenada","Albania","Uzbekistan","Lesotho","Mauritania","Botswana","Malta","Cuba","Djibouti","Burkina Faso","Niger"],["country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country","country"]],"container":"<table class=\"display\">\n <thead>\n <tr>\n <th> <\/th>\n <th>sites<\/th>\n <th>geopoliticalname<\/th>\n <th>geopoliticalunit<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":1},{"orderable":false,"targets":0},{"name":" ","targets":0},{"name":"sites","targets":1},{"name":"geopoliticalname","targets":2},{"name":"geopoliticalunit","targets":3}],"order":[],"autoWidth":false,"orderClasses":false},"selection":{"mode":"multiple","selected":null,"target":"row","selectable":null}},"evals":[],"jsHooks":[]}</script>
</div>
</div>
<div id="table-keys" class="section level2 hasAnchor" number="6.2">
<h2><span class="header-section-number">6.2</span> Table Keys<a href="sql-quickly.html#table-keys" class="anchor-section" aria-label="Anchor link to header"></a></h2>
<p>Within tables there are often Keys. A Key may be a <strong>Primary Key</strong> (PK), which acts as a unique identifier for individual records within a table, or they may be a <strong>Foreign Key</strong> (FK) which refers to a unique identifier in another table. Primary Keys and Foreign Keys are critical to join tables in a SQL query.</p>
<p>In relational databases such as Neotoma you will often have “entity” tables, that represent explicit things (e.g., people, sites), and then tables that express the relationship between entities using foreign keys. So, for example the table <code>ndb.sitegeopoliticalunits</code> expresses the relationship between <code>ndb.sites</code> and <code>ndb.geopoliticalunits</code>. Both <code>ndb.sites</code> and <code>ndb.geopoliticalunits</code> represent entities; a country is a thing, with properties, as is a site. The <code>ndb.sitegeopoliticalunits</code> defines the relationship betwen these things. It is a table with two columns, one is an FK that refers back to the PK, <code>siteid</code>s, in <code>ndb.sites</code>, and one is an FK for the primary key of the <code>ndb.geopoliticalunits</code>.</p>
<p>Switching to the <em>SQL Query</em> tab in the above example will show you that we are using the PK for the <code>geopoliticalunits</code>, <code>geopoliticalid</code>. It links the complete information in the <code>ndb.geopoliticalunits</code> table to the <code>ndb.sites</code> table, through a <code>JOIN</code> table, that has two columns, the <code>siteid</code> that is the PK for <code>ndb.sites</code> and the <code>geopoliticalid</code> column, that is the PK for <code>ndb.geopoliticalunits</code>. In this way, <code>siteid</code> is the PK in <code>ndb.sites</code> and an FK in <code>ndb.sitegeopoliticalunits</code>.</p>
</div>
<div id="data-types" class="section level2 hasAnchor" number="6.3">
<h2><span class="header-section-number">6.3</span> Data Types<a href="sql-quickly.html#data-types" class="anchor-section" aria-label="Anchor link to header"></a></h2>
<p>Neotoma uses several standard SQL data types. You can find out more about these individual data types in the Postgres <a href="https://www.postgresql.org/docs/current/datatype.html">data type documentation</a>.</p>
<div id="query" class="section level3 tabset hasAnchor" number="6.3.1">
<h3><span class="header-section-number">6.3.1</span> Query<a href="sql-quickly.html#query" class="anchor-section" aria-label="Anchor link to header"></a></h3>
<div id="sql-query-1" class="section level4 hasAnchor" number="6.3.1.1">
<h4><span class="header-section-number">6.3.1.1</span> SQL Query<a href="sql-quickly.html#sql-query-1" class="anchor-section" aria-label="Anchor link to header"></a></h4>
</div>
<div id="data" class="section level4 active hasAnchor" number="6.3.1.2">
<h4><span class="header-section-number">6.3.1.2</span> Data<a href="sql-quickly.html#data" class="anchor-section" aria-label="Anchor link to header"></a></h4>
<div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb17-1"><a href="sql-quickly.html#cb17-1" tabindex="-1"></a>DT<span class="sc">::</span><span class="fu">datatable</span>(datatypes)</span></code></pre></div>
<div class="datatables html-widget html-fill-item" id="htmlwidget-488096e098231280920f" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-488096e098231280920f">{"x":{"filter":"none","vertical":false,"data":[["1","2","3","4","5","6","7","8","9","10","11"],["array","bigint","boolean","character varying","date","double precision","integer","numeric","real","text","timestamp without time zone"],[3,4,12,155,12,73,428,9,3,77,284]],"container":"<table class=\"display\">\n <thead>\n <tr>\n <th> <\/th>\n <th>datatype<\/th>\n <th>columns<\/th>\n <\/tr>\n <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":2},{"orderable":false,"targets":0},{"name":" ","targets":0},{"name":"datatype","targets":1},{"name":"columns","targets":2}],"order":[],"autoWidth":false,"orderClasses":false},"selection":{"mode":"multiple","selected":null,"target":"row","selectable":null}},"evals":[],"jsHooks":[]}</script>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
</div>
<a href="searching-for-sites.html" class="navigation navigation-prev " aria-label="Previous page"><i class="fa fa-angle-left"></i></a>
<a href="database-design-concepts.html" class="navigation navigation-next " aria-label="Next page"><i class="fa fa-angle-right"></i></a>
</div>
</div>
<script src="libs/gitbook-2.6.7/js/app.min.js"></script>
<script src="libs/gitbook-2.6.7/js/clipboard.min.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-search.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-sharing.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-fontsettings.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-bookdown.js"></script>
<script src="libs/gitbook-2.6.7/js/jquery.highlight.js"></script>
<script src="libs/gitbook-2.6.7/js/plugin-clipboard.js"></script>
<script>
gitbook.require(["gitbook"], function(gitbook) {
gitbook.start({
"sharing": {
"github": false,
"facebook": true,
"twitter": true,
"linkedin": false,
"weibo": false,
"instapaper": false,
"vk": false,
"whatsapp": false,
"all": ["facebook", "twitter", "linkedin", "weibo", "instapaper"]
},
"fontsettings": {
"theme": "white",
"family": "sans",
"size": 2
},
"edit": null,
"history": {
"link": null,
"text": null
},
"view": {
"link": null,
"text": null
},
"download": null,
"search": {
"engine": "fuse",
"options": null
},
"toc": {
"collapse": "subsection",
"max-depth": 4
}
});
});
</script>
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement("script");
script.type = "text/javascript";
var src = "true";
if (src === "" || src === "true") src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/latest.js?config=TeX-MML-AM_CHTML";
if (location.protocol !== "file:")
if (/^https?:/.test(src))
src = src.replace(/^https?:/, '');
script.src = src;
document.getElementsByTagName("head")[0].appendChild(script);
})();
</script>
</body>
</html>