Search for null joins

Allow searching for missing joins in our query language. For example find all outcomes not linked to certificate.
Jira uses the syntax:

course.classes is EMPTY

or we could go with a more generic approach like:

course.classes.count = 0

That would be more useful for other counting too…

A customer has a specific use case for this type of query:

We would like to perform a query to find all students who enrolled in any course in 2019 but didn’t enrol in 2020. This is for the purposes of sending out marketing emails in order to encourage these students to come back.

For now, an export to CSV in two lists and then running some pivot table on those results is probably simplest. Or even a custom export script in onCourse itself (contacts with extra columns for enrolment count in each year).

These subqueries are even more complicated since they look like:

 student.{ enrolments*.classes*.startDate < 1/1/2020 }.count > 1

That’s pretty hard to map to SQL. Another approach might be to create a synthetic column in the output (count of certain enrolments). Exports are fine, but they make it hard to then perform an action like sending emails.