Return a book
Let's say the borrowing record with ID 1 has been returned.
We can update it with:
sql
UPDATE borrow
SET borrow_return_date = CURRENT_TIMESTAMP
WHERE borrow_id = 1
AND borrow_return_date IS NULL;
sql
SELECT * FROM borrow;
1 should now contain a value in:
text
borrow_return_date
Why checkborrow_return_date IS NULLin theUPDATE?
It prevents the same borrowing record from being "returned" again after it has already been returned.
Sign in to save your progress permanently.
Progress is saved in your browser session
Step 16 of 19