You are on page 1of 54

PROJECT

REPORT
Presentation By

Digital
Digital Library
Library Group 5

UNIVERSITAS SINGAPERBANGSA KARAWANG | INFORMATION INTRODUCTION TO DATABASE


SYSTEM | 2023
Halaman 02

ABSTRAK
Praise and gratitude we pray to the presence of God Almighty who has bestowed His
blessings in the form of opportunities and knowledge, so that I can complete the
final examination assignment for the Introduction to Database course entitled
"Digital Library Database Program Using MySQL". This report was prepared to fulfill
one of the assignments for the second semester course, Introduction to Databases,
under the guidance of Ms. Ultach Enri. We would like to thank the course lecturers
who have provided guidance and supervision in the preparation of this report.
Hopefully this report can be a useful guide for understanding the concept and
implementation of a digital library using a MySQL database.

UNIVERSITAS SINGAPERBANGSA KARAWANG | INTRODUCTION TO DATABASE


INFORMATION SYSTEM | 2023
Halaman 04

ROKI FATIH MUSTHOFA MUHAMMAD DZAKIL A FARREL ZAINDRI A

MHD HARIZ AZHARI LUTHFI AL GHIFARI


Halaman 03

INTRODUCTION
One important aspect of operating an efficient digital
library is data management. With the MySQL database,
digital libraries can take advantage of features such as
efficient collection management. We will explain how
MySQL databases can be used to efficiently store,
manage, and access book data in the context of digital
libraries, and the benefits that can be derived from
implementing them.

Presentation By Group 5
Halaman 04

TABLE OF CONTENT
The following are the points that we will discuss at this time

CREATING DATABASE RELATIONAL CALCULUS

CREATING TABLE DQL COMMANDS

DML COMMANDS DCL COMMANDS

RELATIONAL ALGEBRA ERD

UNSIKA | SISTEM INFORMASI | 2023


Halaman 05

CREATING
DATABASE

· CREATE DATABASE digital_library;


· USE digital_library;
Halaman 08

CREATING
TABLE CREATING TABLE AUTHORS
CREATING TABLE CATEGORIES
CREATING TABLE BOOKS
CREATING TABLE USERS
CREATING TABLE LOANS

UNSIKA | SISTEM INFORMASI | 2023


CREATING TABLE AUTHORS

This command is used to create a new table named "Authors" in the digital_library
database. This table will be used to store information about authors in the context
of digital libraries. The "Authors" table structure consists of two columns:

1. COLUMN "AUTHORID" WITH DATA TYPE INT (INTEGER):


2. FIELD "AUTHORNAME" WITH DATA TYPE VARCHAR(100) (CHARACTER VARIABLE):

UNSIKA | SISTEM INFORMASI | 2023 Halaman 06


Halaman 08

DESCRIBE AUTHORS
TABLE

UNSIKA | SISTEM INFORMASI | 2023


CREATING TABLE CATEGORIES

This command is used to create a new table named "Categories" in the currently
active database. This table will be used to store information about categories in the
context of a digital library. The "Categories" table structure consists of two columns:

1. COLUMN "CATEGORYID" WITH DATA TYPE INT (INTEGER):


2. FIELD "CATEGORYNAME" WITH DATA TYPE VARCHAR(100) (CHARACTER VARIABLE):

UNSIKA | SISTEM INFORMASI | 2023 Halaman 06


Halaman 08

DESCRIBE CATEGORIES
TABLE

UNSIKA | SISTEM INFORMASI | 2023


CREATING TABLE BOOKS

This command is used to create a new table named "Books" in the currently active database. This table
will be used to store information about books in the context of a digital library. The "Books" table
structure consists of four columns:
1. COLUMN "BOOKID" WITH DATA TYPE INT (INTEGER):
2. FIELD "BOOKTITLE" WITH DATA TYPE VARCHAR(100) (CHARACTER VARIABLE):
3. COLUMN "PUBLISHED" WITH DATA TYPE DATE:
4. COLUMN "CATEGORYID" WITH DATA TYPE INT (INTEGER):

UNSIKA | SISTEM INFORMASI | 2023 Halaman 06


Halaman 08

DESCRIBE BOOKS TABLE

UNSIKA | SISTEM INFORMASI | 2023


CREATING TABLE USERS

This command is used to create a new table named "Users" in the currently active database. This table
will be used to store information about users in the context of a digital library. The "Users" table
structure consists of three columns:
1. COLUMN "USERID" WITH DATA TYPE INT (INTEGER):
2. FIELD "USERNAME" WITH DATA TYPE VARCHAR(100) (CHARACTER VARIABLE):
3. COLUMN "USERROLE" WITH DATA TYPE ENUM('ADMIN', 'MEMBER')

UNSIKA | SISTEM INFORMASI | 2023 Halaman 06


Halaman 08

DESCRIBE USERS TABLE

UNSIKA | SISTEM INFORMASI | 2023


CREATING TABLE LOANS
This command is used to create a
new table named "Loans" in the
active database. This table will be
used to store information about
borrowing books in the context of
digital libraries. The "Loans" table
structure consists of five columns:

1. COLUMN "LOANID" WITH DATA TYPE INT (INTEGER):


2. COLUMN "USERID" WITH DATA TYPE INT (INTEGER):
3. COLUMN "BOOKID" WITH DATA TYPE INT (INTEGER):
4. COLUMN "LOANDATE" WITH DATA TYPE DATE (DATE):
5. COLUMN "RETURNDATE" WITH DATA TYPE DATE (DATE):

UNSIKA | SISTEM INFORMASI | 2023 Halaman 06


Halaman 08

DESCRIBE LOANS TABLE

UNSIKA | SISTEM INFORMASI | 2023


Halaman 13

DML COMMANDS
(INSERT (10), UPDATE (10), DELETE (10))
Halaman 07

INSERT COMMAND Insert Authors Table


Halaman 07

INSERT COMMAND Insert Categories Table


Halaman 07

INSERT COMMAND Insert Categories Table


Halaman 07

INSERT COMMAND Insert Books Table


Halaman 07

INSERT COMMAND Insert Users Table


Halaman 07

INSERT COMMAND Insert Loans Table


UPDATE Halaman 09

COMMAND
Halaman 07

DELETE COMMAND
Halaman 11

ALGEBRA (10) AND


CALCULUS RELATIONAL
(10)

Presentasi Oleh GROUP 5


Halaman 07

RELATIONAL ALGEBRA
Relational algebra is a formal query language used to perform operations on relational
database systems. It provides a theoretical foundation for querying and manipulating data
stored in tables, which are organized into relations.

• Select books published in 2022: σ(Published LIKE '2022%', books)

• Project book titles and authors from the "books" and "authors" relations:
Π(BookTitle, AuthorName, books ⨝ authors)

• Join "books" and "loans" relations on BookID: books ⨝ loans


• Select books borrowed by User1: σ(UserID = 1, loans ⨝ books)

• Calculate the total number of books in the library: |books|

• Select books with a category other than Fiction: σ(CategoryID <> 1, books)
Halaman 07

RELATIONAL ALGEBRA
• Calculate the average loan duration for each book: Π(BookID, AVG(ReturnDate - LoanDate), loans)

• Find the authors who have written at least one book in the Fiction category: Π(AuthorName,
authors ⨝ (Π(BookID, CategoryID, σ(CategoryName = 'Fiction', categories)) ⨝ books))

• Select books published before 2022 and borrowed by User2: σ(Published <

'2022-01-01' UserID = 2, books ⨝ loans)

• Find the categories with no borrowed books: Π(CategoryID, categories) -


Π(CategoryID, loans ⨝ books)
Halaman 11

RELATIONAL CALCULUS
Relational calculus is another formal language used to describe and retrieve data from relational
databases. Unlike relational algebra, which focuses on the operations and transformations of data,
relational calculus describes the properties and conditions that data must satisfy in order to be
retrieved.

• Select books published in 2022: { t | ∃t (books(t) ∧ t.Published LIKE '2022%') }


• Project book titles and authors from the "books" and "authors" relations: { t.BookTitle, t.AuthorName | ∃t (books(t)
∧ authors(t)) }

• Join "books" and "loans" relations on BookID: { t | ∃t1, t2 (books(t1) ∧ loans(t2) ∧ t1.BookID = t2.BookID) }
• Select books borrowed by User1: { t | ∃t1, t2 (loans(t1) ∧ books(t2) ∧ t1.UserID = 1 ∧ t1.BookID = t2.BookID) }

• Calculate the total number of books in the library: | { t | ∃t (books(t)) } |


Halaman 11

RELATIONAL CALCULUS
• Select books with a category other than Fiction: { t | ∃t (books(t) ∧ ¬(t.CategoryID = 1)) }
• Calculate the average loan duration for each book: { t.BookID, AVG(t.ReturnDate - t.LoanDate) |∃t (loans(t)) }
• Find the authors who have written at least one book in the Fiction category: { t.AuthorName | ∃t1, t2
(authors(t1) ∧ categories(t2) ∧ books(t3) ∧ t1.AuthorID = t3.AuthorID ∧ t2.CategoryID = t3.CategoryID ∧
t2.CategoryName = 'Fiction') }

• Select books published before 2022 and borrowed by User2: { t | ∃t1, t2 (books(t1) ∧ loans(t2) ∧ t1.Published <
'2022-01-01'∧ t2.UserID = 2 ∧t1.BookID = t2.BookID) }

• Find the categories with no borrowed books: { t.CategoryID | ∃t1, t2 (categories(t1)


Halaman 07

SELECT 15
DQL COMMANDS
DQL COMMANDS

Halaman 10
DQL COMMANDS

Halaman 10
DQL COMMANDS

Halaman 10
DQL COMMANDS

Halaman 10
DQL COMMANDS

Halaman 10
DQL COMMANDS

Halaman 10
DQL COMMANDS

UNSIKA | SISTEM INFORMASI | 2023 Halaman 10


DQL COMMANDS

UNSIKA | SISTEM INFORMASI | 2023 Halaman 10


DQL COMMANDS

Halaman 10
DQL COMMANDS

Halaman 10
DQL COMMANDS

Halaman 10
DQL COMMANDS

Halaman 10
DQL COMMANDS

Halaman 10
DQL COMMANDS

Halaman 10
DCL COMMANDS
DCL Commands (create at least 3 users, GRANT (10), REVOKE (10))
CREATE USERS
GRANT COMMAND
REVOKE COMMAND
ERD

Halaman 10
CONCLUSION
In conclusion, the digital library system
implemented using MariaDB provides a
comprehensive solution for managing and
accessing digital resources. The logical
database design, represented by the Entity-
Relationship Diagram (ERD), ensures proper
organization and relationships between
entities. The Data Definition Language (DDL)
statements create the necessary tables, and
the Data Manipulation Language (DML)
commands enable efficient data manipulation
operations.
GROUP 5
TERIMA
KASIH!
Presentasi Oleh

group 5

You might also like