Professional Documents
Culture Documents
Group Assignment: Technology Park Malaysia CT042-3-1-IDB Introduction To Database NP1F1609IT
Group Assignment: Technology Park Malaysia CT042-3-1-IDB Introduction To Database NP1F1609IT
Group Assignment: Technology Park Malaysia CT042-3-1-IDB Introduction To Database NP1F1609IT
GROUP ASSIGNMENT
TECHNOLOGY PARK MALAYSIA
CT042-3-1-IDB
INTRODUCTION TO DATABASE
NP1F1609IT
HAND OUT DATE: 10 APRIL 2017
WEIGHTAGE: 50%
___________________________________________________________________________
INSTRUCTIONS TO CANDIDATES:
2. Students are advised to underpin their answers with the use of references (Cited
using the Harvard Name System of referencing).
3. Late submissions will be awarded zero (0) unless extenuating Circumstances (EC)
are upheld.
6. Where the assignment should be submitted in both hard copy and softcopy, the
softcopy of the written assignment and source code (where appropriate) should be
on a CD in an envelope/ CD cover and attached to the hardcopy.
SUBMITTED BY
Uday Kumar Sah (NP000097)
Amar Bahadur Bogati (NP000077)
1.1.1 Software
Software is a set of program that used to control better way to manage overall data in the
Database management system (DBMS), the operating system, network software that work as
integration form and give as possible best output of users. And also Application program that
needs for access data in the Database Management System.
1.1.2. Hardware
Hardware is set of physical electronics devices such as computer I/O Devices, Storages
devices that help to provide give a way to excess interface between database and users hardware
components, its major part of database that physically exists.
1.1.3. Data
Data is raw fact. And it most important part of Database management system (DBMS).its
help to make information and information is most important part for decision making. The database
contains both actual or operational data and the metadata.
1
E-Bookstore
1.1.4. Procedures
Procedures is instruction and set of rules and constrains that assists and gives a way to how
to use database management system (DBMS) and in designing and running the database.
Procedures is guidelines for user’s or manager that operates the database.
1.1.5. People
People is person who interact with database management System (DBMS) who need
information about according to decision making on the basis of job which types of information are
provided may be decided by Database Admistrator .people is actually manage or collect
information database. For example: - Staff, Manager, (dataentryoutsourced, n.d.)
1.2. Objective
1. Make Shareability
2. Combining inter-related data
3. Make efficient way to manage data.
4. Controlling Concurrent updates so as to maintain data integrity (management-hub.com,
n.d.)
1. Relational Database
This database stored in various data tubes. Each table has a key field which is used to connect it to
other tubes. Hence all the tables are related these database is extensively used various industries
2
E-Bookstore
and will be the one you are most likely to come across when working in information Technology
(IT).
Some example of relational databases are Sybase and Microsoft SQL Server, Oracle. In this
database process software deployment part included in program. So you can easily project when
creating a project plan and estimating project costs.
2. Database Warehouse
Database Warehouse is important part of organization of organization to achieve any kind’s
information of the several years. Information is very information recover as losses data. Data ware
house is a database is to keep all relevant data for several years. It can be as long as 6 years later.
The data is also an important source of information for analyzing and comparing the current year
data with that of the past years. Which also make it easier to determine key trends taking place.
All the data from previous years are stored in a database warehouse.
3. Operational Database
In this modern technology, operational database is play big role of daily to daily operation of
organizational. Thing of such as inventory management, purchase, financial and transactional. All
data is collected in a database which is often know by several names such as operational /
production database or transactional data.
4. Distributed Database
Some multinational company and organization has several department and branches. Each of these
has their individual database. And collected data as a various geographical disperse and save data
as regional database is known as Distributed. Each of these work group may have their own
database which together will form the main database of the company. This is also distributed
database.
5. End-User Database
In this planet there are different types of database existing .among one of them as us End user
database. Some of database stored as data spreadsheets, presentations, work files, notepad and
others files. This small database form as different types of database called the end-user database.
(My Project Management Expert., n.d.)
3
E-Bookstore
6. Centralized Database
Centralized database is a type of database the keeps all data in a single database system signal
machine called a database server hosts the DBMS and the Database. (omsar, n.d.)
7. Commercial Database
The database to be access is provided to users as a commercial venture is called on commercial or
external database. These types of database making purpose as serves information of external users.
These database are subjected specific and access to these database is sold as a paid services to its
user. There are many commercial database services as available particularly in the area of financial
and technical information.
These commercial database uses as statistics commodity, foreign exchange and stock market ,
companies and their performance important and their buying pattern decided can law’s etc. the
access to commercial database may be given thought communication links . (S, n.d.)
4
E-Bookstore
book_categ
quantity
ory
book_id
book_id publisher_i
book_details d
export_stat
us
M
quantity Check Sended
books
publisher_a
1 ddress
1
M
M publisher_c
Rating of per book
customer_i ountry
d
Avalialbe book check
1
Delivery
feedback
Have Invoice
Place order
feedback_d
opinion
ate
1
M
Give feedback M
rating
IS_paid
M
1
1
M
publisher_i
d
Give Invoice sendorder_det
M publisher_i
ails
d
invoice_id
book_id
quantity
Payment
quantity
order_date
1
book_id
invoice_id
customer_
ContactNo
sales_informa
Customer_
tion
Address customer_
invoice_id IS_Mmber customer_ customer_id
LastName FirstName
5
E-Bookstore
3. Business Rules
1. The supplied books are kept in the university warehouse.
2. An invoice must be send into Account Department.
3. Customer who wish to purchase books online, needs initially register’s as member.
4. Once the complete payment, the customer will able to be print or save the receipts.
5. The store will send the books to the customer within 7 working days.
6. Users can also provide feedback for a book.as a score 1-10 (which 0= means terrible
10=masterpiece) along with the optional short text. No change are allowed; only one
feedback per user per book is allowed.
4. Normalization Process
Database Normalization is a technique of organization the data in the database. Normalization is a
systematic approach of decomposing tables to eliminate data redundancy and undesirable
characteristics like insertion, Update, Deletion Anomalies. It is a multi-step process that puts data
into tabular form by removing duplicated data from the relation tables.
(studytonigh, n.d.)
6
E-Bookstore
key is usually a single column, but sometimes more than one column can be combined to create a
single primary key. For example consider a table which is not in First normal form.
1. First Normal form is only a first step to good design. It’s still possible for a table in 1 NF to be
designed inefficiently. (relationaldbdesign, 2017)
1NF Key
Table of 1NF
Table 1
customer_id P.K
book_id P.K
invoice_id P.K
publisher_id P.K
customer_FirstName
customer_LastName
customer_Address
customer_ContactNo
quantity
feedback
rating
feedback_date
export_status
Is_member
book_category
book_name
book_rate
book_author
ISBN
send_date
order_date
publisher_name
publisher_address
publisher_phone
publisher_country
transaction_id
transaction_date
payment_type
invoice_date
Is_paid
7
E-Bookstore
2. There is one deletion anomaly: if you delete the only item from a publisher, you lose data about
the publisher
3. There is also a modification anomaly. The publisher id is duplicated for every order where they
sends. (relationaldbdesign, 2017)
8
E-Bookstore
3NF key
3NF Key
bill_details sales_information
3NF Key
publisher_id F.K invoice_id F.K
newbook_details
book_id P.K invoice_id F.K transaction_id
invoice_date transaction_date
publisher_id F.K
Is_paid Is_paid
book_category payment_type
book_name
book_rate
book_author
ISBN 3NF key
Send_date opinion 3NF key
customer_id F.K customer_detail
book_id F.K customer_id P.K
feedback invoice_id F.K
3NF key rating book_id F.K
delivery_information feedback_date customer_FirstName
book_id F.K customer_LastName
customer_id F.K customer_Address
export_date customer_contactNo
Quantity quantity
export_status Is_member
9
E-Bookstore
5. Database Schema/Diagram
5.1. Database Hierarchical Schema
Publisher
Member
1. External Model
End user’s view of the data environment and its required that the modeler subdivide set of
requirement and constraints into functional modules that can be examined within the framework
of their external models. In this figure Publisher, Customer, E-bookstore manager is main
perspective of Interact with system so it’s External data Model
Conceptual and logical Model determine to the global view of the database and its
represents of data viewed by the entire organization. A basis for identification and high- level
description of main data objects, avoiding details. Its most widely used conceptual model is an
entity relationship diagram (ER) Model.
10
E-Bookstore
3. Internal Model
In this internal model as represented of the database as “Seen” by the DBMS (Database
management system) and maps of the conceptual model to the specific representation of an internal
model and it is hardware in depended and its lower stages as physical model .and it’s also as
physical model .its operates as lowest level of abstraction of database. (Lai Chew Ping, 2017)
This table of Bill details, here is used field name is invoice_id and publisher_id whose data type
is integer whose length is 4, here is used Foreign key in publisher_id and invoice_id also used
Not Null constant. In invoice_date its data type is date here is also used not null constant.
Is_paid is also a field name its data type is varchar.
11
E-Bookstore
This is the table of book details where field name is book_id, publisher_id, quentity and
book_category etc. In fileld name book_id, publisher_id, quantity here data type is intiger also
uses Not Null constant. book_category its data type is varchar its data length is 10. In the table
in field book_id and publisher_id here is used forign key.
12
E-Bookstore
This is the table of customer details where field name is customer_id, customer_FirstName,
customer_LastName, customer_Address, customer_contact, book_id, invoice_id and
quantity etc. In field name customer_country, customer_firstName, customer_LastName and
customer_Address here is used Not Null constant its data length is 4. In the customer_id here is
used Primary key. And in book_id and invoice_id here is used forign key and also used Not
Null constant.
This is the table of delivery informatiom where is used forign key in book_id and customer_id.
In the field name extort_data here data type is data and export_status data type is varchar and
other field names data type is intiger. Excluding the export_status there is used Not Null
constant.
13
E-Bookstore
In the table of newbook details here is used Primary key in book_id and forign key is used in
publisher_id. The field name book _category, book_name, book_author and ISBN here is
used varchar. In this table here is also used Not Null constant.
Fig:- opinion
14
E-Bookstore
In the table opinion here is used forign key in customer_id and book_id here is also used
NotNull constant. Here used data type name are varchar, intiger and date etc. The table field
names are customer_id, book_id, feedback, rating and feedback_date.
In the table of publisher_datails here is used Primary key in publisher_id here is also used Not
Null constant. Here used field names are publisher_id, publisher_name, publisher_address,
publisher_phone and publisher_country.
15
E-Bookstore
This is the table of sales information here is used forign key in invoice_id. And transaction_id,
transaction_date, invoice_id, Is_paid and payment_type this all are the fields names. Here
used data type are varchar, intiger and date. Here is also used Not Null constant.
In the table of sender details here is used both Primary key and Forign key. Primary key is used
in invoice_id and Forign key is used in book_id and publisher_id. Here is also used Not Null
constant in all the fields. Here used fields name are book_id, publisher_id, quantity,
order_date, and invoice_id.
16
E-Bookstore
This table of Bill details, here is used field name is invoice_id and publisher_id whose data type
is integer whose length is 4, here is used Not Null constant. In invoice_date its data type is date
here is also used not null constant. Foreign key in publisher_id and invoice_id.
17
E-Bookstore
6. Data Dictionary
6.1. Table Name 1:-publisher_details
18
E-Bookstore
19
E-Bookstore
20
E-Bookstore
21
E-Bookstore
7. SQL Statement
7.1. Data Definition Language (DDL)
Data definition language is a standard for command that defines the different structures in
a database. Data definition language (DDL) statements Create, Modify, and Remove
database. Object such as tables, Indexes, and users. Common DDL Statement are create,
Alter and Drop. (Rouse, n.d.)
7.1.1. Create
1. create table publisher_details(publisher_id int not null primary key, publisher_name
varchar(50) not null, publisher_address varchar(50) not null,
publisher_phone varchar(10) unique not null, publisher_country varchar(30) not null)
22
E-Bookstore
23
E-Bookstore
24
E-Bookstore
(export_status='yes')
OR
(export_status='no')
)
7.1.3.Drop
7.2.1. Select
1.1. select *from publisher_details
1.2. select *from book_details
1.3. select *from newbook_details
1.4. select *from sendorder_details
1.5. select *from bill_details
1.6. select *from delivery_information
1.7. select *from customer_details
1.8. select *from sales_information
1.9. select *from opinion
25
E-Bookstore
7.2.2. Update
The command modifies data of one or more records. An update command syntax is update[table
name] set [column name=value] where [condition].
7.2.3. Insert
a. insert into publisher_details values(101,'Saraswati
Stationary','Kathmandu','9804810249','Nepal')
b. insert into newbook_details values(153,101,'Comedy','funckey',205,'Devil
cal','1324567563456','6/7/2017')
c. insert into customer_details
values(501,'Uday','Sah','Jadibuti','9813151323',153,1050,4,'member')
d. insert into book_details values(153,101,6,'Comedy')
e. insert into sendorder_details values(153,'101','6','6/7/2017','1050')
f. insert into bill_details values(1050,101,'6/7/2017','paid')
g. insert into sales_information values(789,1050,'6/07/2017','paid','visa')
h. insert into delivery_information values(153,501,4,'6/7/2017','yes')
i. insert into opinion values(501,153,'this is great book','8','6/7/2017')
7.2.4. Delete
This command is mostly used for removes one or more records from a table according to specified
conditions. Delete command syntax is delete from[table name] where [condition] (techopedia, n.d.)
26
E-Bookstore
/* Question 1*/
select
publisher_details.publisher_id,newbook_details.book_id,book_name,month=datename(MONTH
,send_date)
from publisher_details,newbook_details where
publisher_details.publisher_id=newbook_details.publisher_id
output
/*Question 2*/
select
sendorder_details.publisher_id,publisher_details.publisher_name,newbook_details.book_id,
newbook_details.book_name,sendorder_details.quantity,newbook_details.book_rate,
sendorder_details.invoice_id,month=datename(MONTH,sendorder_details.order_date)
from sendorder_details
inner join newbook_details on sendorder_details.book_id=newbook_details.book_id
inner join publisher_details on sendorder_details.book_id=publisher_details.publisher_id
output
27
E-Bookstore
/*Question 3*/
select bill_details.invoice_id,bill_details.invoice_date,
publisher_details.publisher_name,publisher_details.publisher_address,
totalamount=(sendorder_details.quantity* newbook_details.book_rate)
from bill_details
inner join publisher_details on bill_details.publisher_id=publisher_details.publisher_id
inner join sendorder_details on sendorder_details.invoice_id=bill_details.invoice_id
inner join newbook_details on newbook_details.book_id=sendorder_details.book_id
where Is_paid='unpaid'
output
/*Question 4*/
select customer_id,customer_FirstName,customer_LastName,customer_address,
customer_ContactNo from customer_details where Is_member="Is_member"
output
28
E-Bookstore
/*Question 5*/
select
delivery_information.customer_id,customer_details.customer_FirstName,customer_LastName,
customer_address,customer_ContactNo,delivery_information.book_id,newbook_details.book_na
me,delivery_information.export_date,
delivery_information.export_status
from customer_details
inner join delivery_information on
customer_details.customer_id=delivery_information.customer_id
inner join newbook_details on delivery_information.book_id=newbook_details.book_id
where export_status="export_status"
output
/* Question 6*/
select
newbook_details.book_category,sendorder_details.book_id,newbook_details.book_name,sendor
der_details.quantity
from sendorder_details
inner join newbook_details on sendorder_details.book_id=newbook_details.book_id
where book_category='horror'
output
29
E-Bookstore
/*Question 7*/
select newbook_details.book_category,count(*) as TotalNo_of_Books from newbook_details
where book_id in (select distinct book_id from bill_details)group by
newbook_details.book_category
output
/*Question 8*/
select SUM(sendorder_details.quantity) as
TotalBooks,sum(sendorder_details.quantity*book_rate) as TotalPrice
from sendorder_details join newbook_details on
newbook_details.book_id=sendorder_details.book_id
output
/*Question 9*/
30
E-Bookstore
Conclusion
This project is main motto is all about complete a database structure of APU E-Bookstore. And
finally we are completed those task which is necessary for this project. We gain a lots of knowledge
that help us to complete this assignment project. This database design is helpful for making APU
E-bookstore and we are appreciated in this database we are included all those technique that help
easily data transmission and redundancy and anomalies free database.
31
E-Bookstore
Workload Matrix
Abhishek Negi 0%
32
E-Bookstore
References
C.S, n.d. http://www.cs.ubc.ca. [Online]
Available at: http://www.cs.ubc.ca/nest/dbsl/intro.html
[Accessed 06 july 2017].
Lai Chew Ping, S. L., 2017. Advance Data Modeling. Kulalampur Malaysia: APU.
33
E-Bookstore
34