80 | | SELECT Condition, COUNT(CopyID) AS copy_count |
81 | | FROM book_copies |
82 | | WHERE Condition IN ('Good', 'New') |
83 | | GROUP BY Condition; |
| 80 | SELECT |
| 81 | EXTRACT(YEAR FROM finedate) AS fine_year, |
| 82 | SUM(CASE WHEN status = 'Paid' THEN fineamount ELSE 0 END) AS total_paid, |
| 83 | SUM(CASE WHEN status = 'Unpaid' THEN fineamount ELSE 0 END) AS total_unpaid, |
| 84 | SUM(fineamount) AS total_fines |
| 85 | FROM fine |
| 86 | WHERE EXTRACT(YEAR FROM finedate) = 2024 -- Change year as needed |
| 87 | GROUP BY EXTRACT(YEAR FROM finedate) |
| 88 | ORDER BY fine_year; |