SQL Queries
Last updated
Last updated
The BETYdb repository has a large number of example SQL queries if you search for the terms 'select' and 'join' in its issues.
SQL is the most flexible way of querying data from BETYdb. The full list of tables and schema on the website is up to date with the current database, but the tables below are stable.
These are the core tables required to query traits and yields:
We have created 'views' to make it easier to query data from multiple tables. For example, to lookup the name and location of a site or the names and units of variables. The following query joins multiple tables, and is based on the yieldsview table: