Sie sind auf Seite 1von 37

Database 2019

Contents
Part 1......................................................................................................................................................3
Introduction............................................................................................................................................3
Task 1/P1............................................................................................................................................3
Use an appropriate design tool to design a relational database system for a substantial problem.....3
Choice of tools................................................................................................................................3
Entity Relationship Diagram..........................................................................................................3
1) Entity.......................................................................................................................................3
2) Attribute...................................................................................................................................4
3) Relationship.............................................................................................................................4
a) One to one................................................................................................................................5
b) Many to one.............................................................................................................................5
c) Many to many..........................................................................................................................5
Tool that I used while designing ER Diagram................................................................................6
Data Dictionary...............................................................................................................................6
Normalization.................................................................................................................................8
Snapshots of input and output forms..............................................................................................9
Conclusion:..........................................................................................................................................14
Part 2....................................................................................................................................................14
Introduction..........................................................................................................................................14
Task4/P2...........................................................................................................................................14
Develop the database system with evidence of user interface, output and data validations, and
querying across multiple tables........................................................................................................14
Constraints....................................................................................................................................14
Login page with error messages...................................................................................................16
Snapshots of data entry forms error messages:.............................................................................18
P3......................................................................................................................................................19
Insert statement for every table.....................................................................................................19
Update statement for every table..................................................................................................21
Delete Statement for every table...................................................................................................22
Select statement of every table.....................................................................................................23
Task 8 [P4].......................................................................................................................................24
Raj Maharjan (HND/ First Semester)
1
Database 2019

Testing :........................................................................................................................................24
Conclusion:..........................................................................................................................................25
Part 3....................................................................................................................................................25
Introduction:.........................................................................................................................................25
Task11 [P5]......................................................................................................................................26
Overview of the system................................................................................................................26
Constraints....................................................................................................................................26
Back end user documentation.......................................................................................................27
Store procedure.............................................................................................................................29
Choice of tools..............................................................................................................................30
End user documentation:..............................................................................................................31
Conclusion:..........................................................................................................................................39
Reference:............................................................................................................................................39

Raj Maharjan (HND/ First Semester)


2
Database 2019

Part 1

Introduction
A relational database management system (RDBMS) is a software representing second generation of
database management system (DBMS) which is logically structured with relations (tables). It is now
a common type of database which uses tables which can be modified or insert the data with ease and
supports distributed database.
RDBMS is easy to manipulate i.e. each table data can be updated without disturbing the others. It’s
very easy to check mistakes in RDBMS. The administrator can use control features to a certain group
and grant permissions according to the requirement. It allows a high degree of data independence and
also helps to expand the set-oriented data manipulation languages.
The major objective of this task is to determine whether a student has knowledge of database or not
and if he can design tool and techniques using RDBMS. The task also focuses on the entity
relationship diagram and data dictionary.

Task 1/P1
Use an appropriate design tool to design a relational database system for a substantial problem

Choice of tools
In order to make my program, I have used IDE: VisualStudio-2017 community edition. It is because
it is the latest one with more updated features. It is very user friendly. Among various programming
language to code I have chosen C# using .Net Framework. It is a high level programming language.

Entity Relationship Diagram


An Entity Relationship Diagram (ER diagram) is a non-technical and ambiguities free model of
communication used to get a common and precise understanding of nature of data between
designers, programmers and end users. ER modeling is a graphical presentation of information which
enables to show relationship between objects, things etc. It’s a top to down approach to database
design that begins by identifying an important data called entities. Along with entities an EDR also
consist of relationships, attributes and cardinality.
1) Entity
Entity type is a group of objects with the same properties, which are identified by the enterprise as
having an independent existence. In simple words it is the object that stores information, known
from another object. There are two entity types they are:-

S.N Type of Entity Definition Figure(In ERD)

Raj Maharjan (HND/ First Semester)


3
Database 2019

1. Strong entity type It is an entity type that is not existence-


dependent on some other entity type.

2. Weak entity type It is an entity type that is existence-


dependent on some other entity type.

2) Attribute
Attributes are the properties which define the entity type. These are the particular properties of an
entity which holds the values that describe the entity occurrence. There are different types of
attributes they are :-

S. Type of Attribute Definition Figure(in ERD)


N
1. Key Value It is the minimal set of attributes that
uniquely identifies each occurrence of an
entity type.

2. Composite It is an attribute that consist of two or


Attribute more than two attribute.

3. Multivalued It is an attribute which consist more than


Attribute one value for a given entity.

4. Derived Attribute It is an attribute that represents a value


that is derivable from the value of a
related attribute or a set of attribute not
necessarily of a same entity type.

3) Relationship
A relationship type represents the association between entity types. It helps to show the information
between two entities. In EDR it is denoted by diamond shape.

1) Cardinality
The number of times an entity set participates in a relationship set is known as cardinality. It can be
of different types :-
Raj Maharjan (HND/ First Semester)
4
Database 2019

a) One to one
When each entity in entity set can take part only once in relationship, the cardinality is one to
one.

Let us assume that one male can marry one female and vice versa. So the cardinality is one to
one.
b) Many to one
When entities in one set can take part only once in the relationship set and entities in other set
can take part in more than one in relationship set, cardinality is many to one.

Let us assume that a student can take only one course but one course can be taken by many
students. It means that for one course there can be n students but for one student there will be
only one course.
c) Many to many
When entities in all entity set can take part in more than once in the relationship then the
cardinality is many to many.

Let us assume that a student can take more than one course and one course can be taken by
many students. So the relationship will be many to many.

Tool that I used while designing ER Diagram


The tool that I have used to draw ER diagram is …….This tool allows us to easily create an entity
relational diagram schema. It is an free tool.

Diagram

Raj Maharjan (HND/ First Semester)


5
Database 2019

In above diagram it consists of different entities. As we can see the above diagram consists different
entities which is symbolized by square and the diamond symbolizes the relationship between entities
which are connected by flow lines user, customer, order, supplier, and product are entities whereas
id, names, address, unit etc.are the attributes.

Data Dictionary
Data dictionary is a set of views or tables that provides access to metadata about database schema-list
of tables, columns, keys, etc. In more simpler terms it is a table with data elements (columns) as rows
and their attributes as columns. Specific attributes vary depending on the purpose of the data
dictionary.

Raj Maharjan (HND/ First Semester)


6
Database 2019

Customer table:-

Order table:-

Product table:-

Raj Maharjan (HND/ First Semester)


7
Database 2019

Supplier table:-

Normalization
Normalization is a database design technique which organizes tables in a manner that reduces
redundancy and dependency of data. It divides larger tables to smaller tables and links them using
relationships. Normal forms are used to eliminate or reduce redundancy in database tables.
1) 1NF
It is the First normal form. Here each table cell must have a single value. The records in 1NF
must be unique.
Full Names Address Movie rented Salutation
Raj Maharjan Harisiddhi Endgame Mr.
Raj Maharjan Harisiddhi Split Mr.
Hermione Prasad New Baneshwor Aquaman Ms.
Anjali Rai Pulchowk Lucy Ms.

2) 2NF
We have to divide the 1NF table into two tables. We generally introduce a column as use it as
foreign key.
Id Name Address Salutation
1 Raj Maharjan Harisiddhi Mr.
2 Hermione Prasad Baneshwor Ms.
3 Ajain Rai Pulchowk Ms.

Id Movie rented
1 Endgame
1 Split
2 Aquaman
3 Lucy

Raj Maharjan (HND/ First Semester)


8
Database 2019

Here, we have divided the 1NF table into two tables. We have introduced a new column called Id
which is primary key for table1.
3) 3Nf
Id Name Address Salutation Id
1 Raj Maharjan Harisiddhi 1
2 Hermione Prasad Baneshwor 2
3 Anjali Rai Pulchowk 2

Id Movie rented
1 Endgame
1 Split
2 Aquaman
3 Lucy

Salutation Id Salutation
1 Mr.
2 Ms.
3 Miss.

Here, we have again divided the tables. Salutation Id is introduced which is primary key in
table3. In table 1 Salutation Id is a foreign to primary key in table3.

Snapshots of input and output forms


1) Customer

Input Saved successfully

Saved in customer table in SQL

Raj Maharjan (HND/ First Semester)


9
Database 2019

2) Supplier

Input data

Data saved successfully

Saved in Supplier table of SQL

Raj Maharjan (HND/ First Semester)


10
Database 2019

3) Product

Input

Successfully saved
Raj Maharjan (HND/ First Semester)
11
Database 2019

Saved in Product table of SQL

4) Order

Raj Maharjan (HND/ First Semester)


12
Database 2019

Order placed successfully

Saved in Order table of SQL

Conclusion:
I have designed and discussed about the relational database system. I have discussed about the tools
that I used while designing it. I have discussed about entities, relation and attributes in the EDR. I
also have written about data dictionary and provided the data dictionary of the tables used in the
database while making the application. I have also included normalization of the tables and the input
and output forms system in the program and database.

Part 2

Introduction
Database is a systematic collection of data which supports storage and manipulation of data. It is a
methodical gathering of information which makes information board simple. Constraints helps to
enforce the limits to the data that can be inserted, updated, deleted from a table. Error messages are
displayed when user does something wrong (wrong according to the code in program) while using
the program. Error messages are very essential as it informs the user about what wrong he has done
and gives hints to rectify it when he uses the program again. Various statements are used while
developing the program which helps to insert, update, delete, and select the date data in or from the
tables in the database. After the completion of the application it should be tested. A detailed form by
from test is necessary to check whether there are errors or not. Similarly it also helps to improve the
application.
Task4/P2
Develop the database system with evidence of user interface, output and data validations, and
querying across multiple tables.

Constraints
Constraints enforce limits to the data or type of data that can be inserted, updated, deleted from a
table. The whole purpose of constraints is to maintain the data integrity during an update, delete,
insert into a table. It helps data to be more accurate. Manly constraints are used in column and other
in table. The following are the some of the constraints majorly used:-
1) Nut null
This nut null checks or ensure that the column of data does not contain the empty value. In other
words it represents a value for an attribute that is currently unknown or is not applicable for this
tuple. It takes NULL value by default. Example:-

Raj Maharjan (HND/ First Semester)


13
Database 2019

2) Primary key
The key where the column contains unique record that does not match with any other table. It
uniquely each record in a table. It must have unique values and cannot contain nulls. In below
example ROLL_NO is marked as primary key, that means that ROLL_NO cannot have duplicate
and null values.

3) Foreign key
The key that helps to recognize the column of the table in another one. In other words, A foreign key
is a field in one table that uniquely identifies a row of another table or same table.

4) Index
It helps to catch the data from the database in very short time. It can be created by using a single or
group of columns in a table. Proper indexes are good for performance in large databases, but you
need to be careful while creating an index.

5) Default constraint
It gives value by itself if the record does not have any value provided while inserting a record into a
table.

Raj Maharjan (HND/ First Semester)


14
Database 2019

Login page with error messages


1) When Username is blank

2) When Password is blank

Raj Maharjan (HND/ First Semester)


15
Database 2019

3) When Username is wrong

4) When Password is wrong

Raj Maharjan (HND/ First Semester)


16
Database 2019

Snapshots of data entry forms error messages:


1) Customer

When first name is not entered When last name is not entered

When phone number is not entered

2) Product

When Product name is not entered When supplier Id is not entered


Raj Maharjan (HND/ First Semester)
17
Database 2019

3) Suppliers

When company name is not entered

P3

Insert statement for every table


Insert statement is for inserting the data in the database. It adds a new record in the table. It is
generally kept “Save” button.

Raj Maharjan (HND/ First Semester)


18
Database 2019

1) Customer

2) Supplier

Raj Maharjan (HND/ First Semester)


19
Database 2019

3) Product

4) Order

Update statement for every table


An SQL UPDATE statement changes the data of one or more records in a table. It is used to update
the data of an existing table in the database. It can be used to update both single or multiple tables. It
is generally kept in “Update” button.
1) Customer

Raj Maharjan (HND/ First Semester)


20
Database 2019

2) Supplier

3) Product

Delete Statement for every table


This statement allows us to remove rows from the table. It is used to delete existing records from a
table. It is generally kept in ”Delete” button.
1) Customer

2) Supplier

3) Product

Raj Maharjan (HND/ First Semester)


21
Database 2019

Select statement of every table


It returns a result set of records from one or more tables. It retrieves zero or more rows from one or
more database tables.
1) Customer

2) Supplier

3) Product

Task 8 [P4]
Testing :
S.N. What was tested? Expected output Actual output
1. Login form If the correct username and password is If wrong password, username and blank
written then the Main form must open. password, username was entered then error
Only correct name and password will let messages were displayed.
you enter.

Raj Maharjan (HND/ First Semester)


22
Database 2019

2. Main form It must contain the access of all the forms All the forms were divided according to
present on the application. All the forms types and the user could easily access it by
must be available and should be separated few clicks.
with types.

3. Customer It should be able to insert the new customer It was able to make new customers and
data in the database. It should be able to save them in the database. It was also able
update and delete the saved and existing to update, delete and view the existing
customers. customers in the database.
4. Supplier It should be able to save new supplier as It was able to make new suppliers and save
well as update and delete the current them in database. It was able to update,
existing suppliers in the database. delete and view the existing suppliers in
the database.
5. Product It should be able to add new products in the The new products were able to be saved as
database. It should be able to update and well as the existing products and their
delete the existing products in the database. details were able to view, update and
delete.
6. Order The user should be able to place an order. The user could place an order. The user
The order details should be able to be was able to access the customer and
entered and the user should be able to products from their respective tables and
access the products and customers from was able to place order.
their respective tables.
7. Product report This must allow user to view the total sales The total sales by a product was seen in
by a product in a duration set by the user. the duration set by the user.

Raj Maharjan (HND/ First Semester)


23
Database 2019

8. Country sales The user should be able to view the total The user was able to view total sales done
report sales done by a specific country. The user by a specific country and the countries
must be able to change the countries. could be changed.

9. Order report The user should be able to view the number The user was able to view the number of
of orders made by customers (customer orders made by the customers in a user
name) in a specific user defined year. defined year.

10. Customer report The user should be able to select a customer The user was able to select any customer
from customer table of database and should from customer table and was able to view
be able to view the total purchase and total purchase by them and the purchase
purchase date. date.

Conclusion:
I have discussed about the various constraints I have used in the database of the application that I
have made. It includes primary, foreign keys etc. I have discussed about various error messages
displayed when the user does something wrong according to the codes used. I have provide all the
error messages present in the application. I have tested all the forms present in the application. I have
done detailed tests with expected versus actual outputs of the all the forms presented in the
application. The results of the testing all came positive and the application was valued good to go.

Part 3

Introduction:
The overview of the system is the answer of what, why and for whom the application is made for. It
must contain about the database tables. The limitation of the application is the drawbacks of the
application. It is needed to be studied so that we can better improve our application by rectifying it.
Technical documentation is the document which describes the functionality and handling of the
application. It helps user better understand the application and provides knowledge how to use it.
There can be both front and back end technical documentation which help us better understand how
the application was made and how the data storage takes place. It’s basically is a user guide manual.

Raj Maharjan (HND/ First Semester)


24
Database 2019

Task11 [P5]
Overview of the system
I have created a system for a international vendor which is able to store data on the products that has
been bought from any of its suppliers and data of customers located in different countries that can
make orders on these products. In this application I have made a total of eleven forms. Also in
database I have made six tables. This application is for an international vendor so, in basic I have
included customer table where all the customer data are stored, supplier table where all the supplier
data are stored, product table where all product info are stored and order table where customers and
their ordered info are stored. And I have included sales report, customer report, country sales and
order report. This application is created in order to save time and unnecessary costs.

Constraints
When making the application, we used many advanced codes but all this was to make the application
user friendly. By the efforts the application has become user friendly but its not the most user
friendly application. At least a user who is related with computer systems are required to handle the
application. Another risk of this application is that it can be easily copied. The source code of the
application can be copied. The user should be guided properly as some minor things may lead to
bigger issues. Like the clients are not allowed to enter invalid data types and data information. The
user also cannot enter the same information twice.

Back end user documentation

The database is DBMS contains 6 tables.


Tables
Raj Maharjan (HND/ First Semester)
25
Database 2019

Customer table:-

Order table:-

Product table:-

Raj Maharjan (HND/ First Semester)


26
Database 2019

Supplier table:-

Order item:-

User:-

Store procedure
A stored procedure is a prepared SQL code that can be saved in RDBMS, so the code can be used
over and over again. So if have an SQL query that we have to write over and over again then it can
be saved or sored and can be called upon to execute it. Stored procedure features and command
syntax are exact to the database engine. To save time and memory, extensive or complex processing
that requires execution of several SQL statements can be saved into stored procedures, and all
applications call the procedures.
Two of the stored procedure I used in the application:
Raj Maharjan (HND/ First Semester)
27
Database 2019

Country sales procedure:

Order statement:

Choice of tools
IDE: VisualStudio-2017 community edition
Programming Language – C# using .Net Framework
Relational Database Management System – SQL server -express edition
Platform: Desktop Application

Raj Maharjan (HND/ First Semester)


28
Database 2019

End user documentation:


1) Login form

Here in the Username and password we enter a valid username and password and then click
login. If the username and password is blank or mistake then error message will show up.

Raj Maharjan (HND/ First Semester)


29
Database 2019

2) Main form

This is the main menu of the form where the user can access any form. Inside entry there are
customer, supplier and product. Inside order there is place order and inside report there are sales,
customer, country sales, product and order reports. User can also create usres by clicking in
create users.

Raj Maharjan (HND/ First Semester)


30
Database 2019

3) Customer

Here, new customers can be made by entering all the data and clicking save. The existing data
can also be deleted and updated. These will affect the customer table in the database. Error
message will show if we don’t enter first and last name while saving.
4) Supplier

Raj Maharjan (HND/ First Semester)


31
Database 2019

Here, new suppliers can be made by entering all the data and clicking save. The existing data can
also be deleted and updated. These will affect the supplier table in the database. Error message
will show if we don’t enter company name while saving.

5) Product

Here, new products can be registered by entering all the data and clicking save. The existing data
can also be deleted and updated. These will affect the product table in the database. Error
message will show if we don’t enter product name, supplier id and unit price while saving.

Raj Maharjan (HND/ First Semester)


32
Database 2019

6) Order

When a customer orders a product then it registered in order table from here. Customer and
Product are accessed from the existing database and with their pre specified unit price and user
defined unit the total is calculated.
7) Sales report

Raj Maharjan (HND/ First Semester)


33
Database 2019

Here, sales of a product is calculated. The product can be chosen by the user from the existing
users in the database. The dates can be specified by the user from – to of which duration the sales
of specified product will display.
8) Customer report

Here, user can select a customer from the customers in the existing database table and the total
purchase by the user and purchase dates will be displayed.

9) Country sales report

Here, total sales of a country can be viewed. The user can select any country existing in the
current database and the total sales of that country will be displayed.

Raj Maharjan (HND/ First Semester)


34
Database 2019

10) Order report

Here, the number of order till date can be found out by any customer in a given year. The user is
free to specify any year and the total orders by a customer can be seen in the same year.
11) Create user

Here new users of the application can be created. Simply type in username, valid e-mail address
and password. Then click sign up. This will effect user table of the database.

Raj Maharjan (HND/ First Semester)


35
Database 2019

Conclusion:
I have provided the basic overview of the system including for whom and the contents of the
application. I have also described the limitations of the application and the counter measure of how it
can be rectified. I have provided a user manual guide of both front and back end of the application.
The back end includes the table configurations where the data are to be stored. I have also shown the
process of stored procedure and provided with the examples and stated how it works. I have shown
the front end user guide manual where I have provided the detailed guide about the forms present in
the application. This will help the first time user to better know about the application.

Reference:
Beal
www.webopedia.com

TechoPedia,
www.techopedia.com

Techterms,
https://techterms.com.

Database systems (Fourth edition) [Offline]


Author: Thomas Connolly and Carolyn Begg

Geek for geeks


www.geeksforgeeks.com
Raj Maharjan (HND/ First Semester)
36
Database 2019

Feedspot
https://www.feedspot.com/

Raj Maharjan (HND/ First Semester)


37

Das könnte Ihnen auch gefallen