Database Programming Project Final
Database Programming Project Final
You can access the full photo via this link : https://ibb.co/bWwBN9s
Actors
● Customer: This actor represents any user of the system who wishes to rent
books. Customers have access to various functionalities like registering, logging
in, searching for books, viewing book details, renting and returning books, viewing
their cart and total rent, and logging out.
● Admin: This actor represents users with administrative privileges. Admins can
log in, add new books, update book details, remove books from the system, view
registered users, remove users, and access various reports.
Use Cases
● Register: Customers can create a new account on the system.
● Login: Both customers and admins need to log in to access their respective
functionalities.
● Search Book: Customers can search for books using different criteria.
● View Book Details: Customers can view detailed information about a book,
including its cover page.
● Rent Book: Customers can rent a book, with the rent being calculated based on
the book's market price and the rental period.
● Return Book: Allows customers to return rented books.
● View Cart: Customers can view the books they have added to their cart.
● View Total Rent: Customers can see the total rent for the books they intend to
rent or have rented.
● Logout: Customers and admins can log out of the system.
● Add Book/Update Book Details/Remove Book: Admins can manage the book
inventory by adding new books, updating existing book details, and removing
books from the system.
● View Registered Users/Remove User: Admins can view all registered users and
have the authority to remove users if necessary.
● View Reports: Admins can access various reports such as a list of customers
and their rent costs, previous rents for a particular book, book details, a list of
inactive customers, and a search for books by their main subject. These reports
help in managing the system and making informed decisions.
Relationships
● Association: The lines connecting actors to use cases indicate that the actor is
involved in the use case.
● Extend: Some use cases like "View Reports" have extended use cases connected
with dotted lines. This shows that the base use case can be extended or
enhanced by the additional use case under certain conditions.
To perform normalization on the entities , we would need to first identify the functional
dependencies between the attributes of each entity. Based on these dependencies, we can then
apply normalization rules to ensure that the database is in a normalized form.
- Second Normal Form: There's a single attribute primary key (No partial dependence)
Normalization:
● 1NF: If TelephoneNumbers is stored as a serialized list or array, it violates 1NF. It
should be stored in separate fields or a separate table. Assuming correction, it's
in 1NF.
● 2NF: Since all non-key attributes are fully functionally dependent on the whole of
the primary key, it's in 2NF.
● 3NF: There are no transitive dependencies; all non-key attributes depend only on
CustomerID. It's in 3NF.
2. Book
● Attributes: BookID, Title, LanguageCode, NumberOfPages, MajorTopic,
PublisherID
● Primary Key: BookID
● Functional Dependencies:
● BookID → Title, LanguageCode, NumberOfPages, MajorTopic, PublisherID
Normalization:
● 1NF: Each attribute is atomic and unique per book.
● 2NF: All attributes are fully dependent on the primary key.
● 3NF: There are no transitive dependencies among non-key attributes. It's in 3NF.
3. Publisher
● Attributes: PublisherID, Name, Address
● Primary Key: PublisherID
● Functional Dependencies:
● PublisherID → Name, Address
Normalization:
● 1NF: Each attribute is atomic.
● 2NF: As there's only one key attribute, there is no partial dependency.
● 3NF: No transitive dependencies are present. It's in 3NF.
4. Author
● Attributes: AuthorID, Name
● Primary Key: AuthorID
● Functional Dependencies:
● AuthorID → Name
Normalization:
● 1NF: Each attribute is atomic.
● 2NF: All attributes are fully dependent on the primary key.
● 3NF: No transitive dependencies exist. It's in 3NF.
Normalization:
● 1NF: Both attributes are atomic.
● 2NF: This table is a join table to resolve many-to-many relationships, and each
attribute is part of the primary key.
● 3NF: No non-key attributes means no transitive dependencies. It's in 3NF.
6. BookCopy
● Attributes: CopyID, BookID, Status
● Primary Key: CopyID
● Functional Dependencies:
● CopyID → BookID, Status
Normalization:
● 1NF: Each attribute is atomic.
● 2NF: All attributes are fully dependent on the primary key.
● 3NF: There are no transitive dependencies. It's in 3NF.
7. Rent
● Attributes: RentID, CustomerID, CopyID, StartDate, EndDate, TotalRent
● Primary Key: RentID
● Functional Dependencies:
● RentID → CustomerID, CopyID, StartDate, EndDate, TotalRent
Normalization:
● 1NF: Each attribute is atomic.
● 2NF: All attributes are fully dependent on the primary key.
● 3NF: There are no transitive dependencies among non-key attributes. It's in 3NF.
8. AudioBook
● Attributes: BookID, Duration, AudioFormat
● Primary Key: BookID (also a Foreign Key)
● Functional Dependencies:
● BookID → Duration, AudioFormat
Normalization:
● 1NF: Each attribute is atomic.
● 2NF: All attributes are fully dependent on the primary key.
● 3NF: No transitive dependencies. It's in 3NF.
Data dictionary for each table and Physical Design
Admin
);
Column Name Data Type Description
BookAuthor
BookCopy
Physical Design
Views
Indexes
CREATE INDEX idx_book_title ON Book(Title);
CREATE INDEX idx_author_name ON Author(Name);
CREATE INDEX idx_customer_email ON Customer(Email);
CREATE INDEX idx_rent_dates ON Rent(StartDate, EndDate);