0% found this document useful (0 votes)
3 views4 pages

Database Management Assignment

The document outlines a task to design and implement a SQL database for a Library Management System, focusing on various operations such as DDL, DML, and the use of functions. Key components include managing books, members, transactions, and staff, with specific requirements for creating tables, inserting data, and generating queries. Additionally, it requires the creation of an Entity-Relationship Diagram and views to simplify complex queries for reporting purposes.

Uploaded by

gooogly755
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Database Management Assignment

The document outlines a task to design and implement a SQL database for a Library Management System, focusing on various operations such as DDL, DML, and the use of functions. Key components include managing books, members, transactions, and staff, with specific requirements for creating tables, inserting data, and generating queries. Additionally, it requires the creation of an Entity-Relationship Diagram and views to simplify complex queries for reporting purposes.

Uploaded by

gooogly755
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Pre Mids.

Assignment

Task: Design and Implement a Database for a Library Management System

1. Objective

The objective of this task is to design and implement a comprehensive SQL database for a
Management System that includes a variety of database operations such as DDL (Data
Definition Language), DML (Data Manipulation Language), Date Functions, String Functions,
Number Functions, the creation of an Entity-Relationship Diagram (ERD), and views to
simplify complex queries.

2. Problem Description

The Library Management System should handle various aspects such as book inventory,
member management, and transaction history. The system will need to store the following
information:

1. Books: Information related to books, including their titles, authors, publication dates,
and categories.

2. Members: Information about library members including their names, contact details,
membership status, and registration date.

3. Transactions: Information on when members borrow and return books, including due
dates, fines for late returns, etc.

4. Staff: Information about library staff who manage books and transactions.

3. Entities and Attributes

 Books

o book_id (Primary Key)

o title

o author

o category

o publication_date

o available_quantity

 Members

o member_id (Primary Key)

o first_name
Pre Mids. Assignment

o last_name

o email

o phone

o membership_status

o registration_date

 Transactions

o transaction_id (Primary Key)

o member_id (Foreign Key from Members)

o book_id (Foreign Key from Books)

o borrow_date

o return_date

o due_date

o fine_amount

 Staff

o staff_id (Primary Key)

o first_name

o last_name

o role

o hire_date

4. ERD Diagram

The Entity-Relationship Diagram should represent the relationships between the tables. The
Books table is related to the Transactions table via the book_id, while the Members table is
related to Transactions via the member_id. The Staff table is not directly related to Transactions
but will serve to manage various aspects of library operations.
Pre Mids. Assignment

5. Task Requirements

5.1. Database Schema Design (DDL)

You are required to design the database schema by writing SQL statements for creating the
tables and defining constraints like Primary Key, Foreign Key, and Unique constraints.

1. Create a table for books with attributes like book_id, title, author, category,
publication_date, and available_quantity.

2. Create a table for members with attributes such as member_id, first_name, last_name,
email, phone, membership_status, and registration_date.

3. Create a table for transactions with attributes such as transaction_id, member_id,


book_id, borrow_date, return_date, due_date, and fine_amount.

4. Create a table for staff with attributes like staff_id, first_name, last_name, role, and
hire_date.

5.2. Data Manipulation (DML)

1. Insert data into the Books table.

2. Insert data into the Members table.

3. Insert data into the Transactions table.

4. Insert data into the Staff table.

You should create at least 5 sample records for each table.

5.3. Date Functions

Create queries that use date functions for:

1. Finding overdue books: Write a query to find transactions that are overdue.

2. Calculating fines: Write a query to calculate the fine based on overdue days (for
example, $1 per day).

3. Return date and due date calculations: Calculate the number of days a book is overdue
or due soon.

5.4. String Functions

Create queries using string functions for:

1. Concatenating first and last names: Write a query to concatenate the first and last
names of members into a single column (full name).
Pre Mids. Assignment

2. Searching for books: Write a query to find books whose titles start with a specific word,
for example, books that begin with "The".

5.5. Number Functions

Create queries using number functions for:

1. Total number of available books: Write a query to calculate the total number of
available books in the library (sum of available_quantity in the Books table).

2. Average fine: Write a query to find the average fine amount for overdue transactions.

3. Counting books in a category: Write a query to count how many books belong to a
specific category.

5.6. Views

Create views that simplify complex queries for reporting or frequently accessed data:

1. Overdue Books View: Create a view that lists overdue books along with member details
and fine amounts.

2. Available Books View: Create a view that lists the available books in the library (with
details such as title, author, and category).

3. Members with Active Status View: Create a view that shows members who have an
active membership status, including their details.

6. Submission Requirements

1. SQL Script: The complete SQL script including DDL, DML, and queries for date, string,
and number functions, along with views.

2. ERD Diagram: A detailed Entity-Relationship Diagram showing the entities, attributes,


and relationships.

3. Test Cases: Provide SQL queries to test the functionality of your system (e.g., adding
members, borrowing books, calculating fines).

This task provides you with a comprehensive understanding of database design, SQL queries,
and operations. You will gain practical experience in designing and querying databases using a
variety of SQL functions, including views to simplify the complexity of data retrieval.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy