By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
| BookID | Title | PurchaseDate | Bookstore | City |
|---|---|---|---|---|
| 1 | Cujo | 2022-02-01 | CentralPark1 | New York |
| 2 | The Hotel New Hampshire | 2022-01-08 | TheStrip1 | Las Vegas |
| 3 | Gorky Park | 2022-05-19 | CentralPark2 | New York |
| BookID | BookStatus | TransferDate |
|---|---|---|
| 1 | Rented | 2022-11-01 |
| 1 | Returned | 2022-11-05 |
| 1 | Rented | 2022-11-06 |
| 1 | Returned | 2022-11-09 |
| 2 | Rented | 2022-11-03 |
| 2 | Returned | 2022-11-09 |
| 2 | Rented | 2022-11-15 |
| 2 | Returned | 2022-11-23 |
| 3 | Rented | 2022-11-14 |
| 3 | Returned | 2022-11-21 |
| 3 | Rented | 2022-11-25 |
| 3 | Returned | 2022-11-29 |
| TransferDate | CountRented | CountReturned |
|---|---|---|
| 2022-11-01 | 1 | 0 |
| 2022-11-02 | 1 | 0 |
| 2022-11-03 | 2 | 0 |
| 2022-11-04 | 2 | 0 |
| 2022-11-05 | 1 | 1 |
| 2022-11-06 | 2 | 0 |
| 2022-11-07 | 2 | 0 |
| 2022-11-08 | 2 | 0 |
| 2022-11-09 | 0 | 2 |
| 2022-11-10 | 0 | 0 |
| Status | 01.11 | 02.11 | 03.11 | 04.11 | 05.11 | 06.11 | 07.11 | 08.11 | 09.11 | 10.11 |
|---|---|---|---|---|---|---|---|---|---|---|
| Rented | 1 | 1 | 2 | 2 | 1 | 2 | 2 | 2 | 0 | 0 |
| Returned | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 | 0 |