← All Assignments
Design a Library Management Schema
Problem Statement
Design a relational database schema for a simple library management system. The system should handle: - Books (a book can have multiple copies) - Members who borrow books - Borrow and return tracking Write CREATE TABLE statements for all tables with proper: - Primary keys - Foreign keys - Correct data types - NOT NULL where required Also write 2 queries: 1. List all books currently borrowed (not returned) 2. Find members who have borrowed more than 3 books in total
Sample Data
Think about these entities: - books: id, title, author, genre, total_copies - members: id, name, email, phone, joined_date - borrows: id, book_id, member_id, borrowed_date, returned_date (NULL if not returned)
Expected Output
3 CREATE TABLE statements with proper keys and constraints. Query 1: books where returned_date IS NULL Query 2: members with COUNT(borrows) > 3