Database Design & Development - Bikash Dhakal
Database Design & Development - Bikash Dhakal
Contents
Task 1/ P1...................................................................................................................................................3
Design a relational database system using an appropriate design tools and techniques, containing at
least four tables, with clear statements of user and system requirements.............................................3
1.1Introduction:.....................................................................................................................................3
ER diagram..........................................................................................................................................3
1.2Entity Relationship Diagram (ER Diagram)..................................................................................6
Relationship Diagram............................................................................................................................7
1.3 Data dictionary:...............................................................................................................................8
1.4 Justification Table.........................................................................................................................10
Conclusion............................................................................................................................................10
References............................................................................................................................................11
Task 4/P2 Develop the database system with evidence of user interface, output and data validations,
and querying across multiple tables.......................................................................................................12
Introduction.........................................................................................................................................12
Constraints:..........................................................................................................................................12
1. NOT NULL...............................................................................................................................12
2. Unique Constraints....................................................................................................................13
3. Primary Key...............................................................................................................................13
4. Foreign key................................................................................................................................14
5. Default constraints.....................................................................................................................14
User Interface and Output:.................................................................................................................15
Data Validation:...................................................................................................................................18
Joins......................................................................................................................................................20
a) Inner joins..................................................................................................................................20
b) Left(Outer) Joins........................................................................................................................21
c) Right join...................................................................................................................................23
d) Full join.....................................................................................................................................24
Conclusion............................................................................................................................................25
References............................................................................................................................................26
Task 6 / P3................................................................................................................................................27
Implement a query language into the relational database system.......................................................27
Introduction.........................................................................................................................................27
P a g e 1 | 58
Database Design & Development | Bikash Dhakal
P a g e 2 | 58
Database Design & Development | Bikash Dhakal
Task 1/ P1
Design a relational database system using an appropriate design tools and techniques,
containing at least four tables, with clear statements of user and system requirements.
1.1Introduction:
The newly opened Jaguar International Departmental store is located in Bharatpur, Chitwan.
Since the departmental store is in the initial phase, the store is maintaining all the information
using a traditional concept i.e., the operations of the store are manual the store has decided to
develop a database, so in this assignment I am going to help them as a database operator.
In order to meet the criteria of this task based on the scenario I have done lots of research and
studied about required content. As per task requirement, I have design the ER diagram and Data
Dictionary based on the scenario as I am required to deliver my concepts and ideas to design a
relational database system using an appropriate design tools and techniques, containing at least
four tables according to the requirement of the user and my works on this task are as follows:
ER diagram
Entity Relational Diagram simply ER diagram is the relational diagram that shows the
relationship of entities that are set to be stored in database. It illustrates logical structure of
databases.
Types of ER Diagram:
1. One-to-One (1: 1)- only one entity of one table associated to one entity of another table
2. One-to-Many (1: N)- each entity of one table is associated with at most one entity in
another table but each entity in another table is associated with many entities in one table
P a g e 3 | 58
Database Design & Development | Bikash Dhakal
3. Many-to-Many (M: N)- each entity of one table is associated with many entities of
another table.
Entity
Actions, which are represented by diamond shapes, show how two entities share information in
the
database.
Relationship
Attributes
Information Engineering style shows the relationship between two entities whether they are
connected one to one, one to many or many to many it shows the relationship types.
P a g e 4 | 58
Database Design & Development | Bikash Dhakal
a. Entities – the types of information that are saved in the database are called entities.
b. Relationship- the connection between the entities are relationship.
c. Attributes-the data elements of each entity is attributes. (Lucidchart, 2018)
Advantages of ER diagram
P a g e 5 | 58
Database Design & Development | Bikash Dhakal
Disadvantages of ER diagram
P a g e 6 | 58
Database Design & Development | Bikash Dhakal
Fig: ER Diagram
In above figure I have managed four entity and nineteen attributes along with relations. These
relations are shown briefly with the help of SQL server along with primary key and foreign key
references below:
Relationship Diagram
P a g e 7 | 58
Database Design & Development | Bikash Dhakal
In the above Relationship Diagram, I have created Six Table with their attributes each as per the
requirement of the task. Here, in the Customer table I have given a primary key to the Customer
Id with the data type integer and Customer Name, Customer Address, Customer contact,
customer email with data type Varchar, Varchar, varchar, varchar respectively.
Data dictionary is the collection of different types of names, attributes that we use in SQL query
while creating tables. Such as int, date etc. Through data dictionary we can recognize what type
of value is used for creating the table. So below are some examples that I have used in above
Jaguar billing system. (SearchMicroservices, 2018)
P a g e 8 | 58
Database Design & Development | Bikash Dhakal
P a g e 9 | 58
Database Design & Development | Bikash Dhakal
Conclusion
In this task I have created the ER diagram as well as data dictionary and I have included all the
contents according to demand of the clients and at last I have created the justification table which
briefly describe the client requirements along with justification and status.
References
SearchDataManagement. (2018). What is entity relationship diagram (ERD)? - Definition from
WhatIs.com. [online] Available at:
https://searchdatamanagement.techtarget.com/definition/entity-relationship-diagram-ERD
[Accessed 25 Apr. 2018].
Lucidchart. (2018). Entity-Relationship Diagram Symbols and Notation. [online] Available at:
https://www.lucidchart.com/pages/ER-diagram-symbols-and-meaning [Accessed 27 Apr. 2018].
P a g e 11 | 58
Database Design & Development | Bikash Dhakal
P a g e 12 | 58
Database Design & Development | Bikash Dhakal
Task 4/P2 Develop the database system with evidence of user interface, output and data
validations, and querying across multiple tables.
Introduction
As per scenario demand, on this task I am going to explain about database constraints, user
interface, data validation and different types of SQL joins in this task.
Constraints:
Constraints are the guidelines enforced on the facts columns of a desk. These are used to
restriction the type of information that can pass right into a desk. This ensures the accuracy and
reliability of the data within the database.
Constraints could be both on a column stage or a table stage. The column stage constraints are
implemented only to at least one column, whereas the table level constraints are applied to the
complete table. (www.tutorialspoint.com, 2018)
1. NOT NULL
It is the constraints that ensures that column cannot have null value. It means that when we
specify the nut null constraints, then it cannot have null value in the column. Let’s take example
of not null constraints.
P a g e 13 | 58
Database Design & Development | Bikash Dhakal
The above query will declare that the (cus_contact) field of customer table will not take NULL
value.
2. Unique Constraints
The column or set of columns which has a restrict inside a table, that all the values in that
column should be unique. The column having a unique constraint cannot have a replica cost in
that table.
3. Primary Key
Primary key uniquely identifies the row or record in the database table. It must have unique
values and cannot contain null value in it. Let’s take example of Primary key constraint.
(Lifewire, 2018)
The above query created the primary key in the Pro_ID. Pro_Id will have unique value.
4. Foreign key
Foreign Key is used to relate two tables. FOREIGN KEY constraint is also used to restrict
actions that would destroy links between tables. Let’s take example of foreign key constraint.
P a g e 14 | 58
Database Design & Development | Bikash Dhakal
In above table pro_ID is the foreign key which is primary key on product table which is
mentioned on example of primary key above.
5. Default constraints
The value that are provided by the SQL Server automatically where there is no value during the
time of inserting in the table. It can be null, Constant or a function. (www.tutorialspoint.com,
2018)
P a g e 15 | 58
Database Design & Development | Bikash Dhakal
This Query is use to create table name customer where we input data related with the Customer.
P a g e 16 | 58
Database Design & Development | Bikash Dhakal
So, this query creates Product Table where we can input the data of different products of a
Jaguar_assignment.
This query creates table name Invoice where we can input all the information of a invoice.
P a g e 17 | 58
Database Design & Development | Bikash Dhakal
In this query we create table name category where we input data according the need of table.
This query is use to create Sale table where all the information of the product that are bought by
the Customer can be placed.
P a g e 18 | 58
Database Design & Development | Bikash Dhakal
Data Validation:
Table User interface and out put Remar
Names ks
It is
seen
that the
fields
are
Custom same
er in both
tables
and
form
Product It is
seen
that the
fields
are
same
in both
tables
and
form
P a g e 19 | 58
Database Design & Development | Bikash Dhakal
Categor Here
y we can
see that
both in
Table
as well
as in
Interfa
ce the
Entity
are
same
Invoice It is
seen
that the
fields
are
same
in both
tables
and
form
Sale Here
we can
see that
both in
Table
as well
P a g e 20 | 58
Database Design & Development | Bikash Dhakal
as in
Interfa
ce the
Entity
are
same.
Joins
Join is also another type of retrieve query that gives the output after joining two tables which
have
connection with each other. Following are the types of joins. (W3schools.com, 2018)
a) Inner joins
Returns records that have matching values in both tables
Select all records from Table 1 and Table 2, where the join condition is met.
P a g e 21 | 58
Database Design & Development | Bikash Dhakal
Above pictures show the inner join between customer and product table.
b) Left(Outer) Joins
Select all records from Table 1, along with records from Table 2 for which the join condition I
met
(if at all).
P a g e 22 | 58
Database Design & Development | Bikash Dhakal
Above screen shots show the left join between category and product table.
P a g e 23 | 58
Database Design & Development | Bikash Dhakal
c) Right join
Select all records from Table 1, along with records from Table 2 for which the join condition is
met
(if at all).
P a g e 24 | 58
Database Design & Development | Bikash Dhakal
d) Full join
Select all records from Table 1 and Table 2, regardless of whether the join condition is met or
not.
P a g e 25 | 58
Database Design & Development | Bikash Dhakal
Conclusion
In this task I described about SQL constraints and some types of SQL joins which I have used in
my database management.
P a g e 26 | 58
Database Design & Development | Bikash Dhakal
References
Lifewire. (2018). Learn What a Primary Key in a Database Is and What Makes a Good Key.
[online] Available at: https://www.lifewire.com/primary-key-definition-1019179 [Accessed 28
Apr. 2018].
P a g e 27 | 58
Database Design & Development | Bikash Dhakal
Task 6 / P3
Introduction
Database is to store your data. After storing data, you may need to retrieve that data but if we
want data it gives haphazardly we want specific data so we have to write a specific query for
specific data to view it.
1 INSERT
P a g e 28 | 58
Database Design & Development | Bikash Dhakal
The command insert use in the above Screen shot is use to insert all the data in the Customer
table in their respective columns.
P a g e 29 | 58
Database Design & Development | Bikash Dhakal
P a g e 30 | 58
Database Design & Development | Bikash Dhakal
2 UPDATE
UPDATE is keyword used to update data either its table name column name or data inside the
table.
[condition];
The command Update use in the above Screen shot is use to Update the data in the Customer
table in their respective columns.
P a g e 31 | 58
Database Design & Development | Bikash Dhakal
P a g e 32 | 58
Database Design & Development | Bikash Dhakal
Above screen shot shows the update command for catagory table.
3 SELECT
SELECT is the keyword used to select data from table. It is type of retrieve query.
P a g e 34 | 58
Database Design & Development | Bikash Dhakal
Syntax:
The statement used in picture is used to retrieve all the data from the customer table.
The statement used in picture is used to retrieve all the data from the category table.
P a g e 35 | 58
Database Design & Development | Bikash Dhakal
The command used in above screen shot is used to retrieve all the data from the invoice table.
The statement used in picture is used to retrieve all the data from the sale table.
The command used in screen shot is used to retrieve all the data from the sale table.
4 DELETE
DELETE (Back End)
Syntax:
P a g e 36 | 58
Database Design & Development | Bikash Dhakal
The command used in the above Screen shot is used to delete number of desired column from the
Catagory table.
This is the output after performing delete command in Category table. The column name cat_Id
having value2 has been deleted from catagory table.
In above screen shot we have used delete command to delete desired value of invoice table.
P a g e 37 | 58
Database Design & Development | Bikash Dhakal
Above figure shows successfully deleted the value having inv_ID =2 from invoice table.
P a g e 38 | 58
Database Design & Development | Bikash Dhakal
Query: command used to delete the desire data from product table.
Above screen shot shows the delete command to delete desire value from customer table.
P a g e 39 | 58
Database Design & Development | Bikash Dhakal
Command executed successfully where the data having cus_ID = 6 is deleted from customer
table,
Conclusion:
Without DML no CRUD operation is possible. In every aspect we use DML language whether it
is to create a table or the to insert data in table as well as to update. In same way to create we
create all the tables required in scenario and column along with its data were inserted.
References
DML, W. (2018). What is DDL and DML. [online] Stack Overflow. Available at:
https://stackoverflow.com/questions/2578194/what-is-ddl-and-dml [Accessed 29 Apr. 2018].
P a g e 40 | 58
Database Design & Development | Bikash Dhakal
Task 8/P4
Introduction
In this task I am going to testing database which I have prepared as Jaguar database management
system. Database testing is the testing in which user exams or test the existing facts along with
tables, strategies, query, data duplication etc. Testing is executed with the aid user it can be
achieved in both web software or computing device in database software program like SQL or
oracle. Many initiatives call for database nowadays which include banking, schools and colleges,
business and so on. Within the testing technique many stuffs are checked including double data,
if there's duplicate data or not, if there may be key errors or now not.
4. Incorrect or inefficient or badly written SQL Queries can also lead functionality failure.
1) Integration Test
In this test one-of-a-kind operation on data is examined to ensure that the data and information
are inserted properly with accurate constraints in order that it gives accurate results. This type of
P a g e 41 | 58
Database Design & Development | Bikash Dhakal
testing out is particularly relevant to client/server and distributed systems. The modules are
combined in these testing out and are tested as a group. This testing out enables us to do data
access without mistakes. (www.tutorialspoint.com, 2018)
2) Unit Test
In unit test, testing is done in individual basis. Testing of an individual software component or
module is termed as Unit Testing. This type of testing is usually done by programmer.
(SearchSoftwareQuality, 2018)
3) Stress Test
Stress testing is done to identify the system breakpoint. It stresses the application or software
under test with many loads. This type of testing gives a lot load to the system. In other words, it
can be called stress testing also. (Tech, 2018)
P a g e 42 | 58
Database Design & Development | Bikash Dhakal
P a g e 43 | 58
Database Design & Development | Bikash Dhakal
P a g e 44 | 58
Database Design & Development | Bikash Dhakal
same.
1. Product table
Testing Data value Input value Expected output Actual output Remarks
Unit testing Pro_price It should show error message It shows error Test
for not putting value for not putting successful
value
P a g e 45 | 58
Database Design & Development | Bikash Dhakal
Stress testing Pro_MFG jghhfhj It should show error message for It shows error. Test
putting varchar data instead of successful.
date.
1. Customer table
Testing Data value Input value Expected output Actual output Remarks
P a g e 46 | 58
Database Design & Development | Bikash Dhakal
Unit Cus_contac 98723627893623 It should show error message It shows error for Test
testing t 45 for putting more than limit putting more value. successful
value
Stress Cus_Name 23234 It should be Varchar It accepts numeric, Int values in Test
testing the column of cus_name. successful.
2. Invoice table
Testing Data value Input value Expected output Actual output Remarks
Unit testing Pro_ID It should show error message for not It shows error Test
P a g e 47 | 58
Database Design & Development | Bikash Dhakal
Stress Inv_date 766976 It should show error message for putting It shows error. Test
testing 7 integer data instead of date. successful.
3. Category table
Testing Data value Input value Expected output Actual output Remarks
Unit Pro_ID It should show error message It shows error Test
testing for not putting value for not putting successful
value
P a g e 48 | 58
Database Design & Development | Bikash Dhakal
Stress Pro_ID It should show error message for It shows error. Test
testing putting varchar data instead of successful.
integer.
4. Sale table
Testing Data value Input value Expected output Actual output Remarks
Unit testing agent_ID It should show error message It shows error for Test successful
for not putting value not putting value
P a g e 49 | 58
Database Design & Development | Bikash Dhakal
Stress quantity jgkhg It should show error message for It shows Test
testing putting varchar data instead of integer. error. successful.
Conclusion
There are many features and processes to test the database. Database is used in many
organization so testing is important. Every data should be tested in order to create a good
database if there is duplicate of data or not if the system has error or not. So, testing is important.
In this task I have done the testing of data.
P a g e 50 | 58
Database Design & Development | Bikash Dhakal
References
www.tutorialspoint.com. (2018). Integration Testing. [online] Available at:
https://www.tutorialspoint.com/software_testing_dictionary/integration_testing.htm [Accessed
30 Apr. 2018].
Task 11[P5]
Introduction
The database system is developed to keep records of various things they are taking in a company
which they will offer. For this six table have been created to keep different records of department
store.
P a g e 51 | 58
Database Design & Development | Bikash Dhakal
In this task I am going to produce a user documentation along with user manual and a technical
documentation. In this documentation, there is the overview of database of Jaguar International
Departmental Store with all risks and assumptions involved in database.
Overview
1. Database Name – Jaguar_assignment
2. NO. of Tables – 6
3. Tables – customer, Product, invoice, sale, catagory, login.
4. Administrator Name – Bikash Dhakal
5. IDE Back-end Application – Microsoft SQL Server Management 2012.
6. IDE Front-end Application – Microsoft Visual Studio 2012,
7. Front-end Form Name – Jaguar International Billing System.
Constraint/Risk
A constraint means a projects limitation. I have applied good effort to make software that begins
with including different relationship diagram, entity relation diagram, data dictionary etc.
Interface were designed using the visual studio for user to interact with system. Then, I have
connected the system to SQL and form a relation among table. Various tests such as integration
test, unit test and stress test were performed to ensure the effectiveness of my system.
After the s completion of these system, there were certain constraints or risks to the database
solution of the system. Some are given below.
Assumption
I have designed the database as per the scenario with some assumption, I have designed different
tables which perform different tasks. Assumption of my design are,
For category table I use unique Id, unique name and type.
For product, I have used unique Id, name, price, date (manufacture and expiry).
P a g e 52 | 58
Database Design & Development | Bikash Dhakal
For customer, I have used unique Id, name, e-mail, and contact of customer.
For sale, I use unique Id, agent name, agent ID and quantity.
For invoice, I have used unique Id of product, customer and invoice, name, invoice date.
User Manual
Step 2nd: In this step we have to connect SQL server with the desired Server Name.
P a g e 53 | 58
Database Design & Development | Bikash Dhakal
Step 3rd: This is the step after connecting SQL server with desired Server Name
P a g e 54 | 58
Database Design & Development | Bikash Dhakal
Step 4th: Now, we can see all the database we have create in SQL server which opens when we
Click on Databases.
Step 5th: In this step we have to choose our database name where we have to perform actions like
insert, update and delete command.
P a g e 55 | 58
Database Design & Development | Bikash Dhakal
And the command uses to insert, update and delete data should be used by following steps:
1. Insert command
P a g e 56 | 58
Database Design & Development | Bikash Dhakal
2. Update
3. Delete command
Conclusion
Documentation helps other user to manipulate the data also. With the information given or told
in documentation other user can modify the data as they like. This above documentation contains
the information of Jaguar International Billing System database.
P a g e 58 | 58