bubble_chart StackLab

Database Migration

19 steps · pending Not started · person_outline Guest
arrow_back Back

Find books that are currently borrowed

Remember this rule:

code text
borrow_return_date IS NULL
means the book has not been returned. So we can find all active borrowing records with:
code sql
SELECT
    br.borrow_id,

    CONCAT(
        s.student_first_name,
        ' ',
        s.student_last_name
    ) AS student_name,

    b.book_title,
    b.book_author,
    b.book_category,

    br.borrow_date

FROM borrow br

INNER JOIN students s
    ON br.student_id = s.student_id

INNER JOIN books b
    ON br.book_id = b.book_id

WHERE br.borrow_return_date IS NULL

ORDER BY br.borrow_date DESC;
The key part is:
code sql
WHERE br.borrow_return_date IS NULL
This becomes our active borrowing filter.

login Sign in to save your progress permanently. info Progress is saved in your browser session
format_list_numbered Step 15 of 19