-
Notifications
You must be signed in to change notification settings - Fork 0
Commands
shi edited this page Apr 30, 2021
·
3 revisions
You can more or less figure out what a query does by reading it like a sentence.
And just like a sentence, you can write out a whole query in a single line as linebreaks in these examples are mostly for legibility purposes.
The following lists the most common SQL clauses and operators you can use to create queries.
Commands | What it does |
---|---|
select | Picks fields that contain data of interest |
from | For dQuery, this is usually xson
|
where | Limits the data set we are working with |
and | Additional limits |
or | Additional limits |
not | Additional limits |
like | Use with % or _
|
ilike | Use with % or _
|
as | Use this to name columns |
in | Specifies multiple values |
group by | Aggregates values across row |
order by | Specifies sorting of results with option for asc or desc
|
limit | Limits the number of returned results |
offset | Skips a given number of results |
join | Get data from 2 or more tables |
Documentation is ongoing - please bear with us. Any feedback is appreciated.
- Introduction
- Getting started
- Basic Queries
-
Recipes
- Display count of certain element in org file
- Look for similar
iati-identifier
using a wildcard%
- Filtering on custom namespace elements
- Display iati-organisation id with curated elements within
total-budget
- Group by publishers that use a particular
@ref
- Display first
/narrative
array in multiple roots, count and grouped for a particular@ref
- Display all publishers listing (GIZ) in
participating-org/narrative
- Display all publishers with
conditions@attached
as YES - Display narratives and count, grouped by publishers with
condition@type
- Display narratives grouped by publishers with
condition@type
1 - Display an element attribute, grouped in descending order
- Display full activity data within an element for multiple identifiers
- Display identifiers sorted by the second column (narrative) in descending order
- Display number of items with full activity data for an element and vocab
- Subquery to get full activity data
- Display full activity data with attribute of certain value
- Display unique activity identifiers with attribute of certain value
- Get a table of most used values sorted by count
- Display all activities for a country_code within COVID-19