Upload
ligthyman
View
221
Download
0
Embed Size (px)
Citation preview
8/3/2019 CENG547 Advanced Database Systems
1/64
PROJECT: Library Book Rent System
1
Mohammad Mjallal
Georges Moubarak
8/3/2019 CENG547 Advanced Database Systems
2/64
Introduction
y In this project we chose the topic of Library Book
Rent System which records and organize the work ofbook renting by costumers.
2
8/3/2019 CENG547 Advanced Database Systems
3/64
Tables
Views
Constraints
Triggers
3
8/3/2019 CENG547 Advanced Database Systems
4/64
Tablesy Users
y Coustumers
y
Booksy BookCover
y PublishCompany
y Categories
y Authors
y BookIssue
y Country
y Nationality
4
8/3/2019 CENG547 Advanced Database Systems
5/64
Tables
Views
Constraints
Triggers
5
8/3/2019 CENG547 Advanced Database Systems
6/64
Views:y v_AvgCatRentCost:
This materialized view get the average of rent cost of books in
each category.
y v_CurrentRentedBooks:
This materialized view show books that are currently rented
an
d by who an
d other in
formation
.
y v_Hugebook:
This is an updatable view that show huge books (pages>350).
6
8/3/2019 CENG547 Advanced Database Systems
7/64
Tables
Views
Constraints
Triggers
7
8/3/2019 CENG547 Advanced Database Systems
8/64
Constraints:y Some constraints are done using MS SQL SERVER
Queries, and others are done using the Graphical UserIn
terface code.y For all foreign keys we set the CASCADE rule on delete
and update action.
y Default Value: (issue_on (getdate()) , returned,)
y Greater than Value: ([publish_year]>=(1950)),([pages]>=(10)),
8
8/3/2019 CENG547 Advanced Database Systems
9/64
Tables
Views
Constraints
Triggers
9
8/3/2019 CENG547 Advanced Database Systems
10/64
Triggers:y For Insert Trigger: Q
This trigger was done to all tables and it works in case of multi-rowinsert to check that all rows have been successfully added.
y An instead of trigger that stops us to add a cover to a book notfound. Q
y An instead of trigger that stops us to Rent a book not found or by costumer not found. Q
y 2 triggers are done for Book table: the first stops us to delete abook that is currently rented and the second stops us to decreasethe total time issue numbers. Q
y
2 triggers are don
e for Costumers table: the first stops us to deletea Costumer that is currently rent and the second stops us todecrease the total number of issued book by a costumer. Q
y An instead of trigger that inserts the data into Book table insteadof Huge Book View. Q
10
8/3/2019 CENG547 Advanced Database Systems
11/64
11
8/3/2019 CENG547 Advanced Database Systems
12/64
12
8/3/2019 CENG547 Advanced Database Systems
13/64
Graphical User Interface Part
13
Costumer Administrator
Search for Books
Rent Books
Return Books
add, edit and disable users
manage categories
manage Authors
manage Publish Company
manage Books
view statistics and otherthings
The work in GUI was based on 2 types of users with different actions for each one:
8/3/2019 CENG547 Advanced Database Systems
14/64
Costumers Administrator
Change Password
Common Privilege
14
8/3/2019 CENG547 Advanced Database Systems
15/64
Administrator or Not?EnterUsername and
Password
If OK
Check the Attribute is_system inUsers Table
True(1)
False(0)
Administrator Costumer
15
8/3/2019 CENG547 Advanced Database Systems
16/64
Manage Costumers
NewUser/Costumer
Manage Categories
Manage Authors
Manage Publishers
Add/Edit Book
View Statistics
s16
8/3/2019 CENG547 Advanced Database Systems
17/64
Edit Costumery
First we select the costumer id that we wan
t to edit:
y Than the current information of selected costumer appear:
17
8/3/2019 CENG547 Advanced Database Systems
18/64
18
Edit Coustumer Rules
thecoustumer
will beedited
You cant changethe name to
another that isregistered in the
database
Some fields areunchangeablelike the ID andthe number ofbooks issued.
You cant enter anegative credit.
You cant enter aphone number
formed less than7 numbers
If a costumer isdisabled you
should re-enablethe accountbefore edit it
8/3/2019 CENG547 Advanced Database Systems
19/64
Disable Coustumery
First we select the costumer id that we wan
t to disable:
y Than the current information of selected costumer appear:
19
8/3/2019 CENG547 Advanced Database Systems
20/64
Disable Coustumer Rule
20
thecostumerwill beDisabled
You cant disablea costumer that
is currently
renting at least abook
8/3/2019 CENG547 Advanced Database Systems
21/64
8/3/2019 CENG547 Advanced Database Systems
22/64
New User/Coustumer
22
Create LoginAccount
Fill CostumerInformation
8/3/2019 CENG547 Advanced Database Systems
23/64
Login Account:
y
23
Fill Usernameand password
Check ifusername
already taken
If Not
8/3/2019 CENG547 Advanced Database Systems
24/64
Costumer InformationyAfter the first step finishes successfully the page of costumer
information appears:
24
8/3/2019 CENG547 Advanced Database Systems
25/64
Fill Process:
25
thecostumerwill be
successfullyadded
All fields are
required
You cant enterthe (name, last
name) of
registeredcostumer
The phonenumber must be
numeric and
formed at leastfrom 7 numbers
The credits mustbe numeric and
positive value
8/3/2019 CENG547 Advanced Database Systems
26/64
Manage Coustumers
NewUser/Coustumer
Manage Categories
Manage Authors
Manage Publishers
Add/Edit Book
View Statistics
s26
8/3/2019 CENG547 Advanced Database Systems
27/64
27
ManageCategories
Add
Category
Edit
Category
8/3/2019 CENG547 Advanced Database Systems
28/64
Add Category Process:
28
EnterCategory
Name
Check ifalreadyexists
If Not
8/3/2019 CENG547 Advanced Database Systems
29/64
Edit
Cate
gory Process
29
SelectcategoryTo Edit
EnterTheNew Name
Check IfFound If Not
8/3/2019 CENG547 Advanced Database Systems
30/64
Manage Coustumers
NewUser/Coustumer
Manage Categories
Manage Authors
Manage Publishers
Add/Edit Book
View Statistics
s30
8/3/2019 CENG547 Advanced Database Systems
31/64
31
ManageAuthors
Add
Author
Edit
Author
8/3/2019 CENG547 Advanced Database Systems
32/64
New Author
32
Fill AuthorInformation
Check if FullName already
Exists
If Not
8/3/2019 CENG547 Advanced Database Systems
33/64
Edit Author
33
Edit AuthorInformation
Check if FullName already
Exists
If Not
8/3/2019 CENG547 Advanced Database Systems
34/64
Manage Coustumers
NewUser/Coustumer
Manage Categories
Manage Authors
Manage PublishersAdd/Edit Book
View Statistics
s34
8/3/2019 CENG547 Advanced Database Systems
35/64
35
ManagePublishers
Add
Publisher
Edit
Publisher
8/3/2019 CENG547 Advanced Database Systems
36/64
Add PublishCompany
36
8/3/2019 CENG547 Advanced Database Systems
37/64
PublishCompany Add Rules
37
Publish
Companysuccessfully
added
All fields arerequired
The phonenumber must benumerical andformed at least
from 4 numbers
The fax numbermust be
numerical andformed from 7
numbers
You cant add acompanynamethat is alreadyfound in the
database
8/3/2019 CENG547 Advanced Database Systems
38/64
Edit PublishCompany
38
8/3/2019 CENG547 Advanced Database Systems
39/64
PublishCompany Edit Rules
39
Publish
Companysuccessfully
edited
All fields arerequired
The phonenumber must benumerical andformed at least
from 4 numbers
The fax numbermust be
numerical andformed from 7
numbers
You cant add acompanynamethat is alreadyfound in the
database
8/3/2019 CENG547 Advanced Database Systems
40/64
Manage Coustumers
NewUser/Coustumer
Manage Categories
Manage Authors
Manage Publishers
Add/Edit Book
View Statistics
s40
8/3/2019 CENG547 Advanced Database Systems
41/64
41
Add/Edit
Books
AddBooks
EditBook
AddQuantity
RemoveQuantity
Edit Cost
8/3/2019 CENG547 Advanced Database Systems
42/64
Add Book
42
AddBook AddCover
8/3/2019 CENG547 Advanced Database Systems
43/64
Add Book
43
8/3/2019 CENG547 Advanced Database Systems
44/64
Add Book Rules
44
Booksuccessfully
Added
All fields arerequired
ISBN must benumerical andnot be found in
the database
Publish yearmust be
numerical andgreat than 1950
Quantity mustbe numericaland positive
Edition mustbe numericaland positive
Volume mustbe numericaland positive
Pages must benumerical andgreat than 10
Rent cost mustbe numerical
and great than5$
8/3/2019 CENG547 Advanced Database Systems
45/64
Add Cover
Book Added
Add BookCover?
Yes No
DefaultPicture NoCover
Available willbe added
Select Cover
Cover Added
45
8/3/2019 CENG547 Advanced Database Systems
46/64
Edit Book:Add Quantity
46
Book
QuantitysuccessfullyAdded
And If thecurrent
quantity is 0set the
in_inventorybit to True
The quantityto add is arequired
field
The quantityto add must
be numericaland positive
8/3/2019 CENG547 Advanced Database Systems
47/64
Edit Book: Remove Quantity
47
BookQuantity
successfullyRemoved
And If thenew quantity
is 0 set thein_inventory
bit to false
The quantityto remove is arequired field
The quantityto add must
be numericaland positiveand lower orequal to the
currentquantity
8/3/2019 CENG547 Advanced Database Systems
48/64
Edit Book:Edit Cost
48
Book Cost
SuccessfullyEdited
The newcost is arequired
field
The newcost must
benumericaland greater
than 5$
8/3/2019 CENG547 Advanced Database Systems
49/64
Manage Coustumers
NewUser/Coustumer
Manage Categories
Manage Authors
Manage PublishersAdd/Edit Book
View Statistics
s49
8/3/2019 CENG547 Advanced Database Systems
50/64
50
Statistics
General
Statistics
Search
Statistics
8/3/2019 CENG547 Advanced Database Systems
51/64
51
General Statistics
Current RegisteredCostumers
Current Registered Books
Current RegisteredPublishers
Current RegisteredAuthors
Current Rented History
Average Category RentCost
Current Rented Books
Huge Books
Search Statistics
Max Rented Book
Max Costumer ThatRent
Costumers/Category
Costumers/Publishers
Costumers/Authors
Costumers/Books
Write Query
8/3/2019 CENG547 Advanced Database Systems
52/64
Search/Rent Book
Return Book
52
8/3/2019 CENG547 Advanced Database Systems
53/64
Search Rules
53
Search Result Appear and you
can see covers
byID andcovers for books
search result
The categoryfiled is required
The title field isoptional and
you can enterthe full or a part
of title
8/3/2019 CENG547 Advanced Database Systems
54/64
Rent Rules
54
BookSuccessfully
Rented
Can
t ren
t abook 2 timesby the same
user
ValidateBook
ValidateBalance
8/3/2019 CENG547 Advanced Database Systems
55/64
Search/Rent Book
Return Book
55
8/3/2019 CENG547 Advanced Database Systems
56/64
Return Rules
56
BookSuccessfully
Returned
Get the ID ofcostumer
Get the ID ofbook
If found returnThe book (make
necessaryupdate queries)
8/3/2019 CENG547 Advanced Database Systems
57/64
Change Password:
57
8/3/2019 CENG547 Advanced Database Systems
58/64
ConclusionyAs seen in this project the work with SQL server is
easier in GUI and it offers a lot of services that help usin the operation of deployment of any project.
yAlso, using GUI we can make Constraints, Triggers
58
8/3/2019 CENG547 Advanced Database Systems
59/64
Query:B
59
8/3/2019 CENG547 Advanced Database Systems
60/64
Query:B
60
8/3/2019 CENG547 Advanced Database Systems
61/64
Query:B
61
8/3/2019 CENG547 Advanced Database Systems
62/64
Query:B
62
8/3/2019 CENG547 Advanced Database Systems
63/64
Query:B
63
8/3/2019 CENG547 Advanced Database Systems
64/64
Query:B