Download Assignment 2 - Database Design and more Exercises Database Programming in PDF only on Docsity!
ASSIGNMENT 2 FRONT SHEET
Qualification TEC Level 5 HND Diploma in Computing
Unit number and title Unit 04: Database Design & Development
Submission date November 15, 2021 Date Received 1st submission
Re-submission Date November 28, 2021 Date Received 2nd submission
Student Name Pham Nguyen Nhat Anh Student ID GCC
Class GCC0901^ Assessor name Nguyen Hung Dung
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that
making a false declaration is a form of malpractice.
Student’s signature
Grading grid
P2 P3 P4 P5 M2 M3 M4 M5 D2 D
Summative Feedback: Resubmission Feedback:
Grade: Assessor Signature: Date:
Signature & Date:
university easier including: Online Library system, Student Grading System, Attendance System, CMS
System, Scheduling System, Enrolment Systems, and so on.
You are tasked to select one of those systems to develop database for FPT university. Your tasks are to:
Work with FPT 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:
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:
(1) Assessing whether meaningful data has been extracted through the use of query tools to produce
appropriate management information.
(2) Evaluating the effectiveness of the database solution in relation to user and system requirements, and
suggest improvements.
(3) 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.
(4) 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.
Learning Outcomes and Assessment Criteria (Assignment 2):
Learning Outcome Pass Merit Distinction
LO 2 P2 Develop the database
system with evidence of
user interface, output
and data validations, and
querying across multiple
tables.
P3 Implement a query
language into the
relational database
system.
M2 Implement a fully
functional database
system which includes
system security and
database maintenance.
M3 Assess whether
meaningful data has
been extracted through
the use of query tools to
produce appropriate
management
information.
D2 Evaluate the
effectiveness of the
database solution in
relation to user and
system requirements,
and suggest
improvements.
LO3 P4 Test the system
against user and system
requirements.
M4 Assess the
effectiveness of the
testing, including an
explanation of the
choice of test data used.
LO4 P5 Produce technical
and user documentation.
M5 Produce technical
and user documentation
for a fully functional
system, including ER
Diagram and
normalization
statements and
describing how the
system works.
D3 Assess any future
improvements that may
be required to ensure the
continued effectiveness
of the database system.
I. Implementation (P2)
1. Code snippets to create each table.
Create database ASM_
USE ASM_
--Create table
Create table Student
StudentID char( 10 ) primary key,
StudentName varchar( 50 ) NOT NULL,
Address varchar( 100 ),
Gender varchar( 10 ) NOT NULL check(Gender='Male' OR Gender='Female'),
DateOfBirth datetime NOT NULL
Create table Category
CategoryID char( 10 ) primary key,
CategoryName varchar( 50 )
Create table Book
BookID char( 10 ) primary key,
BookTitle varchar( 100 ),
Quantity int default 0 ,
Price char( 20 ),
CategoryID char( 10 ) foreign key references Category(CategoryID),
Create table BorrowForm
FormID char( 10 ) primary key,
BookID char( 10 ) foreign key references Book(BookID),
StudentID char( 10 ) foreign key references Student(StudentID),
BorrowDate datetime default (getdate()) NOT NULL,
ReturnDate datetime NOT NULL,
Constraint Check_Return check(ReturnDate>=BorrowDate),
Quantity int default 0
2. Code snippets to insert some sample data for each table. Student Table: Student ID Student Name Address Gender Date of birth 01 Ha Ty Phu Ca Mau Male 07/17/ 02 Ho Tan Phat Dong Thap Male 03/2/ 03 Phan Thi Anh Thu Vinh Long Female 06/07/ 04 Phan Chi Tinh Kien Giang Male 05/19/ 05 Pham Nguyen Nhat Anh Ca Mau Male 10/20/ Code in SQL server: --Insert values into Student insert into Student values ('01','Ha Ty Phu','Ca Mau','Male','07/17/2001') insert into Student values ('02','Ho Tan Phat','Dong Thap','Male','03/22/2001') insert into Student values ('03','Phan Thi Anh Thu','Vinh Long','Female','06/07/2001') insert into Student values ('04','Phan Chi Tinh','Kien Giang','Male','05/19/2001') insert into Student values ('05','Pham Nguyen Nhat Anh','Ca Mau','Male','10/20/2001') Category Table: Category ID Category type 001 Romance 002 History 003 Novel 004 Classic
Code in SQL server: --Insert values into BorrowForm insert into BorrowForm values ('1','0002','01','10/11/2021','10/14/2021','1') insert into BorrowForm values ('2','0004','03','10/21/2021','10/24/2021','2') insert into BorrowForm values ('3','0003','02','10/1/2021','10/4/2021','2') insert into BorrowForm values ('4','0001','05','10/10/2021','10/20/2021','1')
**3. Generated Database Diagram of your Implementation.
- Explanations about any changes comparing to your design (if there is).** I have not changed anything from the previous design.
II. User Interfaces & Queries (P3)
1. Student table
Add student: The interface add student information including: Student ID, student name,
address, gender, Date of birth
Code in SQL server:
--Add student insert into Student values ('06','Nguyen Thanh Duy','An Giang','Male','08/12/2001')
Code in SQL server: update Student set StudentName = 'Nguyen Thanh Duy', Address = 'An Giang', Gender = 'Male', DateOfBirth = '08/21/2001' where StudentID = '06' Delete student: Includes 2 interfaces: Select student information already in the database by entering Student ID (Select Student) and delete interface includes: Student ID, student name, address, gender, Date of birth
Code in SQL server --Delete student select * from Student where StudentID = '06' Code in SQL server: delete from BorrowForm where StudentID in (select StudentID from Student where StudentID = '06') delete from Student where StudentID = '06'
2. Category table
Add category: The interface add category information including: Category ID and Category name
Code in SQL server: update Category set CategoryName = 'Comedic' where CategoryID = '005' Delete category: Includes 2 interfaces: Select category information already in the database by entering Category ID (Select Category) and delete interface includes: Category ID and category name Code in SQL server --Delete category select * from Category where CategoryID = '005'
Code in SQL server delete from Book where CategoryID in (select CategoryID from Category where CategoryID = '005') delete from Category where CategoryID = '005'
3. Book table
Add book: The interface add book information including: Book ID, book title, quantity, price, category ID.
Code in SQL server: update Book set BookTitle = 'The Fault in Our Stars', Quantity = '4', Price = '$17' where BookID = '0006' Delete book: Includes 2 interfaces: Select book information already in the database by entering Book ID (Select Book) and delete interface includes: Book ID, book title, quantity, price, category ID.
Code in SQL server: --Delete book select * from Book where BookID = '0006' Code in SQL server: create trigger Book_Delete on Book instead of delete as begin delete from BorrowForm where BookID in (select BookID from deleted) delete from Book where BookID in (select BookID from deleted) end delete from Book where BookID = '0006'