04 DDD - Assignment Brief 2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 35

ASSIGNMENT 2 BRIEF

Qualification BTEC Level 5 HND Diploma in Computing

Unit number Unit 04: Database Design & Development

Assignment title Examination Online System

Academic Year Spring 2020

Unit Tutor Thai Thi Thanh Thao

Issue date 23th February 2021 Submission date 10th March 2021

IV name and date

Submission Format:

Format: This assignment is an Individual assignment and specifically including 2 documents:


(1) sql file of your code and represent your code to your mananger (tutor)
(2) a report documents
You must use font Calibri size 12, set number of the pages and use multiple line spacing at
1.3. Margins must be: left: 1.25 cm; right: 1 cm; top: 1 cm and bottom: 1 cm. The reference
follows Harvard referencing system. The recommended word limit is 2.000-2.500 words. You
will not be penalized for exceeding the total word limit. The cover page of the report has to be
the Assignment front sheet 2.
Submission Students are compulsory to submit the assignment in due date and in a way requested by the
Tutors. The form of submission will be a soft copy posted on http://cms.greenwich.edu.vn/
Note: The Assignment must be your own work, and not copied by or from another student or from
books etc. If you use ideas, quotes or data (such as diagrams) from books, journals or other sources, you
must reference your sources, using the Harvard style. Make sure that you know how to reference properly,
and that understand the guidelines on plagiarism. If you do not, you definitely get fail

Unit Learning Outcomes:

LO2 Develop a fully functional relational database system, based on an existing system design.
LO3 Test the system against user and system requirements.
LO4 Produce technical and user documentation

Assignment Brief and Guidance:

Page 1
You are employed as a Database Developer for a large IT consultancy company namely CST. Your company
has many projects in many fields. And now, with your new position you need to develop several systems
for CST such as: Online Library system, Student Grading System, Online shopping system,
HealthCare system, ...And CST wants to develop some new systems to start up from any staff’s idea in
CST.
You are tasked to select one of those systems to develop database for CST or choose a new one. Your tasks
are to:
Work with CST to find out about current requirements for each system
Analyze the requirements and produce clear statements of user and system requirements.
Design a relational database system using appropriate design tools and techniques
Develop a fully functional relational database system, based on an existing system design.
Test the system against user and system requirements.
Produce technical and user documentation

Part 2 (Assignment 2)
Once the designs have been accepted by your manager you have been asked to:
1. Develop the database system using evidence of user interface, output and data validations and querying
across multiple tables.
You want to include more than just the basics so you will implement a fully functional database system
which will include system security and database maintenance features.
You have decided to implement a query language into the relational database system. The developed system
will be demonstrated to your manager.
Your manager has asked you to include in the report:
2. Assessing whether meaningful data has been extracted through the use of query tools to produce
appropriate management information.
3. Evaluating the effectiveness of the database solution in relation to user and system requirements,
and suggest improvements.
4. Once the system has been developed, you will test the system and your manager will complete a
witness statement indicating how your tests are performing against user and system requirements.
You will produce a brief report assessing the effectiveness of the testing, including an explanation of the
choice of test data used.
5. Lastly you will produce technical and user documentation which will be given to the company.
You want to provide some graphical representations for ease of reference in the technical guide, so you have
decided to produce a technical and user documentation for a fully functional system, including diagrams
showing movement of data through the system, and flowcharts describing how the system works.

Page 2
Learning Outcomes and Assessment Criteria

Pass Merit Distinction

LO2 Develop a fully functional relational database system, based on an existing system design.
LO3 Test the system against user and system requirements.
LO4 Produce technical and user documentation

P2 Develop the database M2 Implement a fully functional LO2 & 3


system with evidence of user database system which includes D2 Evaluate the effectiveness of
interface, output and data system security and database the database solution in relation to
validations, and querying maintenance. user and system requirements, and
across multiple tables. suggest improvements.
M3 Assess whether meaningful
P3 Implement a query data has been extracted through the
language into the relational use of query tools to produce
database system. appropriate management
information.

P4 Test the system against user M4 Assess the effectiveness of the


and system requirements. testing, including an explanation of
the choice of test data used.

P5 Produce technical and user M5 Produce technical and user D3 Assess any future improvements that
documentation. documentation for a fully functional may be required to ensure the continued
effectiveness of the database system.
system, including ER Diagram and
normalization statements and
describing how the system works.

Page 3
Table of content
Answer .............................................................................................................................................................. 6
1. Develop the database system ..................................................................................................................... 6
1.1. User interface ...................................................................................................................................... 6
1.1.1. Student Login Page ...................................................................................................................... 6
1.1.2. Student Register Page .................................................................................................................. 7
1.1.3. First page of online examination ................................................................................................. 8
1.1.4. Examination page ........................................................................................................................ 9
1.1.5. User login page .......................................................................................................................... 10
1.1.6. Add question page ..................................................................................................................... 11
1.2. Output Database ................................................................................................................................ 12
1.3. Data Validation ................................................................................................................................. 15
2. Query language ........................................................................................................................................ 18
2.1. Insert data .......................................................................................................................................... 19
2.2. Update data ....................................................................................................................................... 20
2.3. Delete data......................................................................................................................................... 21
2.4. Advanced queries .............................................................................................................................. 22
3. Test log .................................................................................................................................................... 23
3.1. Command .......................................................................................................................................... 23
3.2. Testing ............................................................................................................................................... 24
4. Technical and user document .................................................................................................................. 26
4.1. The instruction for installing the database ........................................................................................ 26
4.2. The instruction for updating and deleting record from table ............................................................ 29
4.3. The instructions for getting data form database ................................................................................ 31
5. Document Control ................................................................................................................................... 34
6. References................................................................................................................................................ 35

Page 4
Table of figure
Figure 1: Download SQL Server management studio 19 ................................................................................ 27
Figure 2: Installing SQL Server management studio 19 ................................................................................. 27
Figure 3: Connect to SQL Server instance ...................................................................................................... 28
Figure 4: Connect to SQL Server instance done ............................................................................................. 28
Figure 5: SQL Query ....................................................................................................................................... 29
Figure 6: Database ........................................................................................................................................... 29
Figure 7: Table ................................................................................................................................................. 30
Figure 8: Edit top 200 row ............................................................................................................................... 31

Page 5
Answer
1. Develop the database system

1.1. User interface

1.1.1. Student Login Page

Page 6
1.1.2. Student Register Page

Page 7
1.1.3. First page of online examination

Page 8
1.1.4. Examination page

Page 9
1.1.5. User login page

Page 10
1.1.6. Add question page

Page 11
1.2. Output Database
Field name: dbo.Users

Field name: dbo.Groups

Field name: dbo.Exams

Page 12
Field name: dbo.Students

Field name: dbo.Question_Answer

Page 13
Field name: dbo.ExamResults

Page 14
1.3. Data Validation
SQL constraints are used to specify rules for the data in a table.

Constraints are used to limit the type of data that can go into a table. This ensures the accuracy and reliability
of the data in the table. If there is any violation between the constraint and the data action, the action is
aborted.

Page 15
➢ I used constraint to limit data that user can create maximum is 5000 accounts for this table.

➢ I used constraint to limit data that user can create maximum is 1000 groups for this table.

➢ I used constraint to limit data that can create maximum is 2000 exams and each exam can create
minimum 1 minutes and maximum 280 minutes to finish this examination into table.

Page 16
➢ I used constraint to limit data that user can create maximum is 10000 students and check this student
is above 16 ages for this table.

➢ I used constraint to limit data that user can create maximum is 20 questions and check this question
has 4 answers for this table.

➢ I used constraint to limit data that check this question has 4 answers for this table.

Page 17
2. Query language
In this section, we create stored procedure with INSERT, SELECT, UPDATE AND DELECT query. With
one statement, thus we can save time to add new rows, update values or delete records from database.

Page 18
2.1. Insert data
We insert fulfill the data in the required fields. And @StatementType is Insert.

And we select data from Users then we see a new row added to database table.

Page 19
2.2. Update data
After that, if we see any name or any value wrong is this database table. We use update statement as below:

So that, we see the row updated to database table as below:

Page 20
2.3. Delete data
For deleting database, we check Users table with UserID = 17235 and we do not need to fill values in this
required fields but we need to enter some values if we cannot remember.

And we check Users table following deleted data where id is 17235, it does not exist.

Page 21
2.4. Advanced queries
QUERY 1: SELECT * FROM Question_Answer

It lists the details of the question & answer in the examination.

QUERY 2: SELECT * FROM Students

It lists the details of the students including students' names, username, password, age and contact.

QUERY 3: SELECT * FROM ExamResult

It lists the detail of result of exam.

QUERY 4: UPDATE ExamResults SET ExamsID = 5002 WHERE QnAsID = 10;

It has changed the id of the exam with question_answer ID 10 from ‘5001' to ‘5002'.

QUERY 5: SELECT FullName FROM Students ST


INNER JOIN Groups G ON ST.GroupID = G.GroupID
WHERE G.GroupID = 1002

It lists name of student on group 1002

QUERY 5: SELECT ST.FullName, QA.Question, ER.Answer, QA.Answer


FROM (ExamResults ER INNER JOIN Students ST ON ER.StudentID = ST.StudentID)
INNER JOIN Question_Answer QA ON ER.QnAsID = QA.QnAsID AND ER.Answer =
QA.Answer

It lists name of student, question, answer the same with result

Page 22
3. Test log

3.1. Command
Set 1: INSERT INTO Users

VALUES

(19000, N'Trần Văn A', 'ATVGCS19000@gmail.com','ATV@123')

Set 2: SELECT * FROM Users

Set 3: Update Users set Password = 'Tri@123' where UserID = 19221

Set 4: DELETE FROM Users WHERE UserID = 18223

Set 5: SELECT FullName , UserName FROM Students WHERE Age <= 21

Set 6: INSERT INTO Students


VALUES
(50007, 1002, N'Nguyễn Văn B', 'STD_NVB','NVB@1', 15,'NVB', null)

Set 7: CREATE FUNCTION dbo.vaValidEmail(@EMAIL varchar(50))

RETURNS bit as
BEGIN
DECLARE @bitRetVal as Bit
IF (@EMAIL <> '' AND @EMAIL NOT LIKE '_%@__%.__%')
SET @bitRetVal = 0 -- Invalid
ELSE
SET @bitRetVal = 1 -- Valid
RETURN @bitRetVal
END

SELECT * FROM Students WHERE dbo.vaValidEmail(Contact) = 0;

DELETE FROM Students WHERE StudentID = 50006;

ALTER TABLE Students


ADD CONSTRAINT check_students_email CHECK(Contact LIKE '%___@___%')

Set 8: SELECT G.GroupID ,R1.FullName FROM Groups G


LEFT JOIN Students R1 ON R1.GroupID = G.GroupID
LEFT JOIN Exams R2 ON R2.GroupID = G.GroupID
WHERE R1.GroupID IS NOT NULL
AND R2.GroupID IS NOT NULL

Page 23
3.2. Testing
Test What is being How Test Expected Date Actual Action
tested data Result results taken

TC1 Add new user Enter data from Set 1 The user March Ok None
data capture sheet was stored 7, 2021
into insert into the
database

TC2 Show list of Select all users in Set 2 Show all March Ok None
users the Users table with values Uses 7, 2021
query Select

TC3 Update Update the Set 3 Update March Ok None


password id password Tri123@ password 7, 2021
19221 with id 19221 Tri@123 to
Tri123@

TC4 Delete Delete the User Set 4 Delete User March Ok None
UserID = with id 18223 with id 7, 2021
18223 18223

TC5 Show Name Use the query Set 5 The result March Ok None
and Select to show will show 7, 2021
UserName of Name and Name and
Students UserName of UserName
having Age Students having of Students
<= 21 Age <= 21 having Age
<= 21

TC6 Add new Enter data from Set 6 Data cannot March Ok None
Students data capture sheet store 7, 2021
having Age < into insert because
16 statement
conflicted
with the
CHECK
constraint

Page 24
TC7 Order of input Enter data from Set 1 Data entry March Ok None
on data entry data capture sheet order is the 7, 2021
screen into the form on the same as that
data entry screen on the data
capture
sheet

TC8 Validation of Enter typical Set 7 Good data March Email not Recode,
input values, boundary accepted; 7, 2021 validating add
value, values that bad data constraint
should be rejected rejected and re-test

TC9 Check Enter Set 8 This Id are March Ok None


whether the not 7, 2021
references for referenced
foreign keys in any of the
are valid tables

TC10 Retest Enter typical Set 7 Good data March Ok None


validation of values, boundary accepted; 8, 2021
input value, values that bad data
should be rejected rejected

Testing has been done in parallel with database development and execution. The stage of the testing process
has been described below.

• During the database design process, it is checked whether the business rules and data integrity
constraints are preserved, normalization is performed properly or not. and whether functions are
preserved after normalization.
• Then during database development and implementation, the code was checked for typos. Once the
database has been developed, the data is carefully inserted according to business rules, user
requirements, and data integrity constraints.
• Finally, during query execution, it is checked to see if there are all tables in the database, are all the
tables filled with matching records or not, the data is enough to check it or not.
• Followed by a table containing details about the use cases. It helps to make a detailed comparison of
the expected and actual results of the different use cases, and comments are also added to indicate
whether the results match.

Page 25
4. Technical and user document

4.1. The instruction for installing the database


Following these steps to install Examination Online System:

1. Download SQL Server 2019 express edition in the internet - (Link: https://www.microsoft.com/en-
us/sql-server/sql-server-downloads )

Page 26
Figure 1: Download SQL Server management studio 19
2. Installing SQL Server management studio 19 and connect with relational database management
system to work on it.

Figure 2: Installing SQL Server management studio 19

Page 27
3. Using SA user that you have chosen during the installation in SQL Server management studio 19 to
connect to SQL Server instance.

Figure 3: Connect to SQL Server instance

Figure 4: Connect to SQL Server instance done


Page 28
4. Find and open the script named SQL Query Examination_Online in new query, after that execute the
script.

Figure 5: SQL Query

4.2. The instruction for updating and deleting record from


table
In some situation, user needs to update or delete the data for database. Following steps below to do this:

1) In the left side of the interface, it has a window which name “object explorer”. Clicking on the
“Examination_Online” database.

Figure 6: Database

2) The list will be appeared on the screen, find a table folder.


Page 29
Figure 7: Table

3) Right click on the table that you want to work on.

4) Choose the choice “edit top 200 row” to add or remove data.

Page 30
Figure 8: Edit top 200 row

4.3. The instructions for getting data form database


In this section, I will guide you guys about how to take an information from only one table and from many
tables:

From 1 table: In the query, please enter the code below:

Select *from [table Name]

Page 31
For example: Select * from Users

From many tables: In the query, please enter some the code below:

1/ Select [column], [column], etc. From [ table name] as ….

join [ table name] as …. where [condition]

For example, 1:

SELECT FullName FROM Students ST


INNER JOIN Groups G ON ST.GroupID = G.GroupID

WHERE G.GroupID = 1002

Page 32
2/ Select [column], [column], etc. From [ table name] as ….

join [ table name] as …. on [same column}

For example, 2:

SELECT ST.FullName, QA.Question, ER.Answer, QA.Answer


FROM (ExamResults ER INNER JOIN Students ST ON ER.StudentID = ST.StudentID)
INNER JOIN Question_Answer QA ON ER.QnAsID = QA.QnAsID AND ER.Answer =
QA.Answer

Page 33
5. Document Control
Title: Examination Online System
Issue: Issue 1

Date: March 7, 2021


Author: Nguyen Duc Hoang

DOCUMENT CHANGE RECORD

Date Version Author Change Details

March 7, 2021 Issue 1 Draft Nguyen Duc Hoang First complete draft
1

March 8, 2021 Issue 1 Draft Nguyen Duc Hoang Review and update
2

March 8, 2021 Issue 1 Draft Nguyen Duc Hoang Review and Submit
3

Page 34
6. References
[1] SQL Server Tutorial. 2021. SQL Server Views - Learn about Views in SQL Server. [online] Available at:
<https://www.sqlservertutorial.net/sql-server-views/> [Accessed 6 March 2021].

[2] Sites.google.com. 2021. Chapter 4- Purpose, Scope and Applicability - Online Examination Synopsis.
[online] Available at: <https://sites.google.com/site/mcabcaprojectandsynopsis/purpose-scope-and-
applicability> [Accessed 6 March 2021].

[3] Lucidchart. 2021. What is a Database Schema. [online] Available at:


<https://www.lucidchart.com/pages/database-diagram/database-schema> [Accessed 6 March 2021].

Page 35

You might also like