meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| pluginto:useful_sql_queries [2026/01/21 17:16] – joetulenko | pluginto:useful_sql_queries [2026/07/21 15:36] (current) – joetulenko | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| Find here some suggestions on how to structure your queries, some things to be aware of when making queries, and some examples of useful queries you can directly copy and paste into your SQL program that should work in ICE-D. | Find here some suggestions on how to structure your queries, some things to be aware of when making queries, and some examples of useful queries you can directly copy and paste into your SQL program that should work in ICE-D. | ||
| + | |||
| + | **07/21/26 update: Joe has gained more experience and will be updating this page to reflect that soon.** | ||
| \\ | \\ | ||
| Line 91: | Line 93: | ||
| For example, **samples** and **publications** are linked through a two-way relation because it is possible for a publication to have many samples (it better, right? It would hopefully be tough to publish a paper with only ONE exposure age reported in it), but it is also possible for one sample to be referenced in multiple publications (perhaps a research group ran a sample back in the day, but recently re-ran another aliquot of the same exact sample and discussed that sample in a new publication). | For example, **samples** and **publications** are linked through a two-way relation because it is possible for a publication to have many samples (it better, right? It would hopefully be tough to publish a paper with only ONE exposure age reported in it), but it is also possible for one sample to be referenced in multiple publications (perhaps a research group ran a sample back in the day, but recently re-ran another aliquot of the same exact sample and discussed that sample in a new publication). | ||
| - | Thus, IF YOU DO NOT WANT TO SELECT INFORMATION FROM A SAMPLE MORE THAN ONCE and it shows up in multiple publications, | + | Thus, IF YOU DO NOT WANT TO SELECT INFORMATION FROM A SAMPLE MORE THAN ONCE and it shows up in multiple publications, |
| \\ | \\ | ||
| Line 311: | Line 313: | ||
| 9. LEFT JOIN - let's say I want info on a bunch of samples from multiple fields/ | 9. LEFT JOIN - let's say I want info on a bunch of samples from multiple fields/ | ||
| - | In the example below, I am searching for sample names, sample 10Be concentrations, | + | In the example below, I am searching for sample names, sample 10Be (and/or 26Al) concentrations, |
| - | (1) samples that only have 10Be concentrations (or 26Al concentrations) \\ | + | (1) samples that only have 10Be concentrations (and/or 26Al concentrations) \\ |
| (2) samples that only have 14C concentrations \\ | (2) samples that only have 14C concentrations \\ | ||
| (3) samples that have both 10Be (and/or 26Al concentrations) AND 14C concentrations \\ | (3) samples that have both 10Be (and/or 26Al concentrations) AND 14C concentrations \\ | ||
| - | (4) rare case where samples have none of the above - likely because a sample is linked to an incomplete entry in either the 10Be/26Al table or the 14C table that's missing nuclide concentration(s) \\ | + | (4) samples have none of the above - likely because a sample is linked to an incomplete entry in either the 10Be/26Al table and/or the 14C table that's missing nuclide concentration(s) \\ |
| - | (using a standard JOIN would only select samples that satisfy criteria 3) | + | (using a standard JOIN would only select samples that satisfy criteria 3 and in rare cases 4) |
| < | < | ||