Objective: Design a fully normalised relational library database in Oracle SQL, populate it with 25 books by 15 classic and contemporary authors, and write 15 analytical queries demonstrating a range of techniques from basic SELECT to correlated subqueries and self-joins.
Key Finding: The collection holds 54 copies across 25 titles and 10 genres, with an overall availability rate of 61%. Mystery and Horror have the lowest availability (25% and 40% respectively), with 3 titles fully checked out. 5 active reservations signal a backlog. Two schema-level defects were identified — a syntax error in the final query and a typo in a CHECK constraint.
Interactive Slicer
Filter by Genre
Select a genre to explore individual titles. The chart updates to show each book's total and available copies. The table filters accordingly.
| Title | Author | Genre | Total Copies | Available | Status |
|---|---|---|---|---|---|
| 1984 | George Orwell | Dystopian Fiction | 3 | 1 | Partial |
| The Handmaid's Tale | Margaret Atwood | Dystopian Fiction | 3 | 1 | Partial |
| War and Peace | Leo Tolstoy | Historical Fiction | 1 | 0 | Unavailable |
| A Farewell to Arms | Ernest Hemingway | Historical Fiction | 2 | 2 | Available |
| HP: Sorcerer's Stone | J.K. Rowling | Fantasy | 4 | 2 | Partial |
| HP: Chamber of Secrets | J.K. Rowling | Fantasy | 3 | 3 | Available |
| The Shining | Stephen King | Horror | 2 | 0 | Unavailable |
| Murder on Orient Express | Agatha Christie | Mystery | 2 | 0 | Unavailable |
| The Great Gatsby | F. Scott Fitzgerald | Classic | 3 | 2 | Partial |
| One Hundred Years of Solitude | Gabriel García Márquez | Magical Realism | 2 | 1 | Partial |
Collection Analysis
Availability & Genre Coverage
- 01Mystery and Horror face the highest demand pressure — with availability rates of 25% and 40% respectively, both genres are undersupplied. Three books in these genres have zero copies left on the shelf.
- 02Fantasy leads in total copy count (7 across 2 titles). This reflects deliberate acquisition strategy — high-demand titles like Harry Potter justify multiple copies to serve concurrent readers without long wait times.
- 03Historical Fiction is the most represented genre (4 titles, 7 copies) — spanning Hemingway, Dickens, Tolstoy, and Morrison. Broad literary coverage but uneven availability (War and Peace: 0 copies left).
- 045 active reservations are queued for unavailable books — The Shining (2 reservations), Orient Express, 1984, and War and Peace each have at least one member waiting, signalling unmet demand.
- 05The "Other" group (Political Satire, Modernist, Adventure, Sci-Fi) shows 100% availability — all 7 copies of Animal Farm, Mrs Dalloway, Tom Sawyer, and Oryx and Crake are on the shelf, suggesting lower circulation demand.
SQL Technique Breakdown
Query Complexity & Technique Coverage
15 queries were written covering the full spectrum of Oracle SQL — from basic data retrieval to multi-level correlated subqueries and set operations. The chart maps each technique to the number of queries that employ it.
- 06Query 7 is the most complex — a correlated subquery inside a WHERE clause. It finds members who borrowed more books than the average, requiring a subquery to compute the average of a subquery: a three-level nested structure.
- 07Query 14 uses a self-join to find books by the same author — joining the books table to itself on author_id, using a less-than condition on book_id to avoid duplicate pairs. One of the most elegant patterns in relational SQL.
Risk Assessment
⚠ Schema & Data Quality Risks
SYSDATE - due_date, but the schema has no column to record fine amounts or payment status. Overdue logic exists in queries but not in the data model — this is an incomplete design that would require schema changes before production use.Action Items
✓ Recommendations
fine_per_day NUMBER DEFAULT 0.50 and a fine_paid VARCHAR2(3) DEFAULT 'NO' column to the loans table. This would make Query 11 actionable — turning an analytical query into an operational tool for library staff to manage overdue collections. The analytical foundation already exists; only the schema needs extending.