AccessionSQL, one case at a time
#008Level 2 of 5 · Scenario 2: The Loans Register

Who has borrowed from us

Scenario 2 · The Loans Register

Before Thursday the chair wants the full list of institutions we have lent to — each one once, not once per loan.

Schema · 2 tables
borrowers
  • idpkINTEGER
  • nameVARCHAR
  • cityVARCHAR
loans
  • idpkINTEGER
  • object_titleVARCHAR
  • borrowerVARCHAR
  • sent_onDATE
  • due_onDATE
  • returned_onDATE
  • courierVARCHAR
  • condition_backVARCHAR

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.
DESC
Reverse the sort: largest or latest first.
DISTINCT
Collapse duplicate rows down to one of each.
Objective

Return every institution that appears in the register, listed once each, alphabetically.

Your query

starting DuckDB…
loading editor…

Results

No result yet.