#009Level 3 of 5 · Scenario 2: The Loans Register
What is still out
Scenario 2 · The Loans Register
A loan that has come back has a return date against it. One that has not come back has nothing in that column — not a zero, not a blank, nothing. The registrar needs to know what is still out, soonest due first.
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. NULL never equals anything, so = will not do it.
Objective
Return the object title, borrower and due date for every loan that has not been returned, earliest due date first.
Your query
⌘ ⏎
Results
No result yet.