An April loan report is based on borrowing date. A loan returned in May still belongs if it began in April. The ::text cast is PostgreSQL shorthand for CAST(... AS text), used only for display.
These tables are already loaded at the start of this lesson.
rentalsOne row represents one borrowing record.
| Field / SQL type | Meaning | Rules |
|---|---|---|
rental_id · integer | Identifier of the rental. | Primary key. Required; cannot be NULL. |
borrowed_on · date | Borrowing calendar date; no time of day or time zone. | Nullable; NULL means no borrowed on value is recorded. |
returned_on · date | Return calendar date; no time of day or time zone. | Nullable; NULL means no returned on value is recorded. |
These rows do not reference the earlier gear table. A missing return date means no return date is recorded, not a zero-length rental or an automatic count through today. No date-order check is declared.
Write your query in script.sql. Use Run to inspect it, then Submit.
Filter borrowed_on; returned_on does not decide the borrowing month.