You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
here's an example of running a SQL query to get statistical info from WOF admin records:
#!/bin/bash
sqlite3 'data/store.sqlite3'<<SQL
SELECT
json_extract( json, '$.placetype' ) AS placetype,
CAST( AVG( json_extract( json, '$.population' ) ) ASINT ) AS average_population
FROM docs
WHERE json_extract( json, '$.population' ) IS NOT NULLGROUP BY placetype
ORDER BY average_population DESC;
SQL
running the command outputs average populations grouped by placetype:
#!/bin/bash
sqlite3 'data/store.sqlite3'<<SQLSELECT e.key, COUNT(*) as totalFROM docs, json_each( json_extract( docs.json, '$.names' ) ) as eGROUP BY e.keyORDER BY total DESCLIMIT 10;SQL
#!/bin/bash
sqlite3 'data/store.sqlite3'<<SQLSELECT DISTINCT(id) FROM ( SELECT docs.id, 0 AS lineage, SUBSTR( key, 1, LENGTH( key ) -3 ), CAST( value AS INTEGER ) FROM docs, json_each( json_extract( docs.json, '$.lineage[0]' ) ) UNION ALL SELECT docs.id, 1 AS lineage, SUBSTR( key, 1, LENGTH( key ) -3 ), CAST( value AS INTEGER ) FROM docs, json_each( json_extract( docs.json, '$.lineage[1]' ) ) UNION ALL SELECT docs.id, 2 AS lineage, SUBSTR( key, 1, LENGTH( key ) -3 ), CAST( value AS INTEGER ) FROM docs, json_each( json_extract( docs.json, '$.lineage[2]' ) ) UNION ALL SELECT docs.id, 3 AS lineage, SUBSTR( key, 1, LENGTH( key ) -3 ), CAST( value AS INTEGER ) FROM docs, json_each( json_extract( docs.json, '$.lineage[3]' ) ) UNION ALL SELECT docs.id, 4 AS lineage, SUBSTR( key, 1, LENGTH( key ) -3 ), CAST( value AS INTEGER ) FROM docs, json_each( json_extract( docs.json, '$.lineage[4]' ) ) UNION ALL SELECT docs.id, 5 AS lineage, SUBSTR( key, 1, LENGTH( key ) -3 ), CAST( value AS INTEGER ) FROM docs, json_each( json_extract( docs.json, '$.lineage[5]' ) ))WHERE lineage = 5SQL
here's an example of running a SQL query to get statistical info from WOF admin records:
running the command outputs average populations grouped by placetype:
The text was updated successfully, but these errors were encountered: