AccessionSQL, one case at a time
#019Level 2 of 6 · Scenario 4: Provenance

Everything we hold

Scenario 4 · Provenance

The insurer rejected the last list. They do not want the objects whose ownership is documented — they want every object in the building, and they want the gaps visible so somebody can go and fill them in.

Schema · 3 tables
owners
  • idpkINTEGER
  • nameVARCHAR
  • countryVARCHAR
objects
  • idpkINTEGER
  • titleVARCHAR
  • wingVARCHAR
  • current_owner_idINTEGER
transfers
  • idpkINTEGER
  • object_idINTEGER
  • seqINTEGER
  • from_owner_idINTEGER
  • to_owner_idINTEGER
  • transferred_onDATE
  • document_refVARCHAR

Toolkit

SELECT
Choose which columns come back.
FROM
Specify which table to read.
WHERE
Filter rows by a condition.
ORDER BY
Sort the results by a column.
IS NULL
Test whether a value is missing.
INNER JOIN
Keeps only rows that matched.
LEFT JOIN
Keeps every row from the first table, filling the other side with NULL where nothing matched.
ON
The condition the two tables match on.
Objective

Return the title and owner name for every object, including the ones with no owner recorded, alphabetically by title.

Your query

starting DuckDB…
loading editor…

Results

No result yet.