#010Level 4 of 5 · Scenario 2: The Loans Register
Mind the gaps
Scenario 2 · The Loans Register
Everything still out needs chasing, and the first thing you chase is the courier who has it. Some of those records have no courier against them at all, and a blank column in a chase list gets read as "nothing to do here".
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.
- IS NULL
- Test whether a value is missing.
- COALESCE
- Return the first argument that is not missing. Give it a fallback last.
Objective
Return the object title and courier for every loan not yet returned, showing "no courier recorded" where the courier is missing, in alphabetical order by title.
Your query
⌘ ⏎
Results
No result yet.