0% found this document useful (0 votes)
43 views

A.Create: Name: Doni Antoro NIM: 20180801039

The document contains Doni Antoro's class assignment on database design for a digital library. It includes sections on creating tables for books, borrowers, employees and loan records using SQL commands. It also provides examples of SELECT, INSERT, UPDATE and DELETE queries. Finally, it presents a use case diagram and data flow diagrams at different levels to model the flow of data between administrators, employees and borrowers.

Uploaded by

batak manurung
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

A.Create: Name: Doni Antoro NIM: 20180801039

The document contains Doni Antoro's class assignment on database design for a digital library. It includes sections on creating tables for books, borrowers, employees and loan records using SQL commands. It also provides examples of SELECT, INSERT, UPDATE and DELETE queries. Finally, it presents a use case diagram and data flow diagrams at different levels to model the flow of data between administrators, employees and borrowers.

Uploaded by

batak manurung
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Name : Doni Antoro

NIM : 20180801039

DDL

A.CREATE

1.Create Database

Create database digitalLibrary ;

2.Create Table

CREATE TABLE IF NOT EXISTS `loan_book` (


`id` int(11) NOT NULL AUTO_INCREMENT, `id_employe` int(11) NOT NULL,`id_borrower` int(11) NOT
NULL, `id_book` int(11) NOT NULL,
`date _of_borrowing` date NOT NULL,
`deadline` date NOT NULL,
`date_of_return` date NOT NULL,
`fine` int(5) NOT NULL,
PRIMARY KEY (`id`)
)

CREATE TABLE IF NOT EXISTS `library_employe` (


`id_employe` int(3) NOT NULL AUTO_INCREMENT,
`name_employe` varchar(50) NOT NULL,
`id_number_employee` int (8) NOT NULL,
`position` varchar(25) NOT NULL,
PRIMARY KEY (`id_ employe `)
)
CREATE TABLE IF NOT EXISTS `borrower` (
`id_ borrower` int(11) NOT NULL AUTO_INCREMENT,
`name_borrower` varchar(50) NOT NULL,
`id_number` varchar(12) NOT NULL,
`adress_borrower` varchar(50) NOT NULL,
`sex` char(2) NOT NULL,
PRIMARY KEY (`id_ borrower `)
)
CREATE TABLE IF NOT EXISTS `book_case` (
`id_book` int(11) NOT NULL AUTO_INCREMENT,
`book’s_name` varchar(50) NOT NULL,
`writter ` varchar(50) NOT NULL,
`Publication_book` varchar (50) NOT NULL,
`case` varchar(50) NOT NULL,
`category` varchar(50) NOT NULL,
`Synopsis` text NOT NULL,
PRIMARY KEY (`id_ book `)
)

DML
1. DROP database

Drop digitalLibrary;

2. ALTER Coloum

ALTER table ‘table name (like book_case/borrower/library_employe/loan_book)’ ADD ‘New coloum’ Varchar(50)

ALTER table ‘table name (like book_case/borrower/library_employe/loan_book)’ DROP coloum ‘ coloum name’

3. DROP Table

DROP TABLE ‘table_name like book_case/borrower/library_employe/loan_book’

DML

SELECT

-for admin

Select * from loan_book


inner join library_employe
inner join borrower
inner join book_case
on
loan_book.id = library_employe.id_employe,
loan_book.id= borrower.id_borrower,
loan_book.id=book_case.id_bookcase
order by ASC

-for borrower
select * from book_case where book’s_name where id_borrower ‘% find %’

Insert

Insert into book_case (‘0’,’harry_potter’,’doni Antoro’,’Gramedia’,’AS110’,’FIksi’,’this book is’)

UPDATE
UPDATE book_case
SET Writter = ‘JK ROWLING’ WHERE id_book = condition;

DELETE

DELETE FROM book_case WHERE id_book = condition;

USE CASE DIAGRAM

Id
Name
Position Number
Name
Return
Fine

Library Employee Borrower


Loan_book

Deadline Date_bor
rowing Sex
Adress
Id_number

Category
Case

Writter

Book Case

Publication Book’s
Synopsis
Name
DFD
-Level 0

INPUT
ADMIN BOOK

Show
Borrower
Book

-Level 1

Borrower Look for


BOOK

Input date
Book ADMIN
borrower
-Level 2

Borrower Look for


BOOK

Input date
Book ADMIN
borrower

delete date update book Input new


book book

You might also like