Professional Documents
Culture Documents
Unit number and title Unit 04: Database Design & Development
Submission date Aug – 26th - 2021 Date Received 1st submission Aug – 26th - 2021
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 D3
❒ Summative Feedback: ❒ Resubmission Feedback:
LO2 Develop a fully functional relational database system, based on an existing system design.
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
information.
data used.
P5 Produce technical and M5 Produce technical and user D3 Assess any future
Table of Contents
I. Implementation (P2) 6
1. Code snippets to create each table 8
2. Code snippets to insert some sample data for each table 3
3. Generated Database Diagram of implementation 10
4. Explanations about any changes comparing to design 10
Secondly, I would like to create next Table is Rooms have 2 properties roomId and nameRoom
and set roomId is primary key, I could use the statement in below:
Result:
Thirdly, Follow the statement to create table subjects have studentID, subjectID,
nameSubjects, startDate, endDate and set subjectID is primary key, set studentID is foreign
key in below:
Result:
Finally, I would like to create table Attendances to attendance students have 5 properties are
subjectID, studentID and are foreign key then attendanceID going to primary key:
CREATE TABLE Attendances (
attendanceId INT NOT NULL PRIMARY KEY,
subjectId INT NOT NULL,
roomId INT NOT NULL,
studentId INT NOT NULL,
attendanceDate VARCHAR(50) NOT NULL,
attendanceStatus BOOL,
FOREIGN KEY(roomId) REFERENCES ROOM(roomId),
FOREIGN KEY(studentId) REFERENCES students(studentId),
FOREIGN KEY(subjectId) REFERENCES subjects(subjectId)
);
Result:
Result:
Result:
Note: Status to attendance students is 0 and 1, If the value is 1, The status will Present and
otherwise
Result:
In the User Adding student, I am going to insert some data in text fill
And click on button has text “Add new Student” and the result will return same like this:
The data has insert into table, When we are clicking on button “Add new student” the button
is going to call the syntax SQL “INSERT INTO (fullname,address,dob,major) VALUES (‘Lam
Hong Thanh’,’Phuong 26, Binh Thanh, TP. HCM’,’09-01-2009’,’Technical Lead’)” and then the
data is going to save to student table in database
Some User Interface for each other functions
View details Information:
Delete students
Result:
The User Interface for attendance:
And I would like to watch the student data in table student and I am using the syntax:
SELECT * FROM STUDENTS
The result after the above syntax:
In my table we have some value is null in other column and I want to click on “Update” button
Data will update. Firstly I would like to update information of student have studentID equal 1
and the syntax I would like to use for this case is:
Finally, I want to click on “Delete” button and delete the data, In the above table I have two
rows have null column at address, dob and major, and I would like to delete all of them, the
syntax delete is going to like this:
I would like to add some student in a room have same their major when I click on “Add”
button in U.I:
Insert some data into database have table room in SQL:
INSERT INTO room (roomId,nameRoom, time, studentId) VALUES
(101,'R101','9:00-13:00',1);
INSERT INTO room (roomId,nameRoom, time, studentId) VALUES
(102,'R102','9:00-13:00',2);
INSERT INTO room (roomId,nameRoom, time, studentId) VALUES
(103,'R103','9:00-13:00',3);
INSERT INTO room (roomId,nameRoom, time, studentId) VALUES
(104,'R104','9:00-13:00',4);
INSERT INTO room (roomId,nameRoom, time, studentId) VALUES
(105,'R105','9:00-13:00',5);
In here I want to search the information of student has last name “Nguyen” and return the
data have format: Student ID, Full Name, Major, Room ID, Subject Name, and status:
Syntax SQL:
Test case 3:
SELECT s.studentId,s.fullname,s.major
FROM students AS s
WHERE s.fullname LIKE 'L%';
Result of test case 3:
Test case 4:
SELECT s.studentId,s.fullname, subjects.nameSubjects, s.major
FROM students AS s
JOIN subjects ON subjects.nameSubjects = 'Networking';
Result of test case 4:
Test case 5:
SELECT s.studentId,s.fullname, room.nameRoom
FROM students AS s
JOIN room ON room.nameRoom = 'R101';
Result of test case 5:
Test case 6:
Celko, J., 2017. Validation, Verification, and Modification - Simple Talk. [ONLINE] Simple Talk. Available
at: https://www.red-gate.com/simple-talk/databases/sql-server/t-sql-programming-sql-
server/validation-verification-modification/. [Accessed 26 August 2021].