0% found this document useful (0 votes)
486 views12 pages

Ict450 SQL Exercise Question

1. The document provides instructions for students to complete SQL exercises to create and query a database for a Hospital Jasin system. 2. Students are asked to create tables for doctors, patients, wards, and patient duties with various fields and data types, as well as relationships between the tables. 3. Students then enter sample data into the tables and write SQL queries to insert new data, display data from multiple tables, and filter results based on conditions.

Uploaded by

Fiffy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
486 views12 pages

Ict450 SQL Exercise Question

1. The document provides instructions for students to complete SQL exercises to create and query a database for a Hospital Jasin system. 2. Students are asked to create tables for doctors, patients, wards, and patient duties with various fields and data types, as well as relationships between the tables. 3. Students then enter sample data into the tables and write SQL queries to insert new data, display data from multiple tables, and filter results based on conditions.

Uploaded by

Fiffy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

CONFIDENTIAL DEC2023/ICT450

UNIVERSITI TEKNOLOGI MARA


SQL EXERCISES

COURSE : DATABASE DESIGN AND APPLICATION /


DATABASE DESIGN AND DEVELOPMENT
COURSE CODE : ITS432 / ICT450

DATE : 18 DECEMBER 2023

STUDENT NAME : NORFIFFYSHAMIZA BINTI NORSAMSUYAR

UiTM ID NO. : 2023299258 GROUP : CDCS2301A

LECTURER : NOR INTAN SHAFINI BINTI NASARUDDIN

INSTRUCTIONS TO CANDIDATES

1. This question paper consists of TWO (2) parts, PART A and PART B.
2. Answer ALL questions.

3. Answer ALL questions in English.

Part Full Marks Your Marks


A 10
B 30

Total Marks 40

Each of your screenshots needs to include : It must shows your


database’s name

SQL / Output

© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL


CONFIDENTIAL DEC2023/ICT450

PART A (10 MARKS)

You need to develop a Hospital Jasin Database System based on the following requirements:

1. Create a blank Access database in the Microsoft Access and save as:

“YourFullName_StudentID.accdb”
(1 mark)

2. Create a table named DOCTOR having the following Structure:

Field Name Data Type


DocID Number
DocFName Text
DocLName Text
Gender Text
Expertise Text

Set the field DocID as the Primary Key.


Set the caption property of the DocID field to Doctor ID.
Set the caption property of the DocFName field to Doctor First Name.
Set the caption property of the DocLName field to Doctor Last Name.
(1 mark)

3. Create a table called PATIENT having the following structure:

Field Name Data Type


PatID Number
PatName Text
PatAddr Text
PatGender Text
ContactNo Number

Set the field PatID as the Primary Key.


Set the caption property of the PatID field to Patient ID.
Set the caption property of the PatName field to Patient Name.
Set the caption property of the PatAddr field to patient Address.
Set the caption property of the PatGender field to Patient Gender.
(1 mark)

4. Create a table called WARD having the following structure:

Field Name Data Type


WardID Text
WardName Text
Location Text

Set the field WardID as the Primary Key.


Set the caption property of the WardID field to Ward ID.
Set the caption property of the WardName field to Ward Name.
(1 mark)

© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL


CONFIDENTIAL DEC2023/ICT450

5. Create a table called DUTY having the following structure:

Field Name Data Type


RecordID Number or AutoNumber
DocID Number
WardID Text
PatID Number
BedNo Text
Diagnosis Text
DateDiagnoses Date

Set the field RecordID as the Primary Key.


Set the caption property of the DocIDfield to Doctor ID.
Set the caption property of the WardID field to Ward ID.
Set the caption property of the PatID field to Patient ID.
(1 mark)

6. Create a relationship for these tables. Put a checkmark in the box labeled Enforce Referential
Integrity.
(1 mark)

7. Enter the following data and add TWO (2) additional rows of data entry for the DOCTOR
table:

DocID DocFName DocLName Gender Expertise


101 Muhammad Fateh Faisal Male Surgery

102 Nur Aisyah Arman Female Neurology

103 Sumayyah Idris Female Haematology

(1 mark)

8. Enter the following data and add TWO (2) additional rows of data entry for the PATIENT
table:

PatID PatName PatAddr PatGender ContactNo

111 Chang Ngan Ying JC 2088, Jalan LKP 16, 77000 Male 017-1234567
Jasin, Melaka

222 Ibrahim Bin Hanafi JC 404, Taman Maju, 77000 Male 012-4327889
Jasin, Melaka

333 Lee Mei Ling JC 1717, Taman Merlimau Female 013-5577123


Permai, 77300 Merlimau,
Melaka

444 Ibrahim Bin Ali 1234, Kampung Buluh Gading, Male 017-6778899
Manir 21200 Kuala
Terengganu, Terengganu

© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL


CONFIDENTIAL DEC2023/ICT450

(1 mark)

9. Enter the following data and add TWO (2) additional rows of data entry for the WARD table:

WardID WardName Location

C5 Medical Ward Level 1, Block C

C10 Surgery Ward Level 2, Block C

A4 First Class Ward Level 4, Block A

(1 mark)

10. Enter the following data and add TWO (2) additional rows of data entry for the DUTY table:

RecordID DocID WardID PatID BedNo Diagnosis DateDiagnose

1 102 C5 444 24 Epilepsy 15/6/2023

2 103 A4 333 11 Low blood pressure 10/5/2023

3 101 C10 222 16 Tumor in stomach 1/5/2023

(1 mark)

PART B (30 MARKS)

Based on database you have created in Part A, write SQL statements and screenshot of your Microsoft
Access’s output for the following queries:

© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL


CONFIDENTIAL DEC2023/ICT450

1. Insert a new column named “Age” in PATIENT table.

(2 mark)
2. Insert a new doctor data with the following:

The doctor ID = 104 (you can insert other ID here)


Doctor First Name = Hyunjin
Doctor Last Name = Hwang
Gender = Male
Expertise = Surgery

(2 marks)

© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL


CONFIDENTIAL DEC2023/ICT450

3. Display the doctors’ full name and their expertise.

(2 marks)

4. Display the doctors’ full name and their expertise who oversees patient name ‘Ibrahim’;

(2 marks)

© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL


CONFIDENTIAL DEC2023/ICT450

5. List all the patient's name who are from ‘Melaka’.

(2 marks)

6. Display total number of patients who are from ‘Melaka’.

(2 marks)

© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL


CONFIDENTIAL DEC2023/ICT450

7. Display total number of duties that has been assigned for each doctor.

(2 marks)

8. Display total number of doctors who are on duty for each ward.

(2 marks)

© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL


CONFIDENTIAL DEC2023/ICT450

9. Display total number of doctors who are on duty for each ward from 1-May-2023 to 16-May-2023.

(2 marks)

10. List the doctor’s name and expertise who are not assigned to any duty for any wards.

(2 marks)

© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL


CONFIDENTIAL DEC2023/ICT450

11. Trace the history of patient name ‘Lee Mei Ling’. Display the patient name, ward name, diagnosis,
date diagnose and the doctor’s name on duty.

(2 marks)

12. Display total number of patients for each ward.

(2 marks)

© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL


CONFIDENTIAL DEC2023/ICT450

13. List the WardID that currently holds number of patients less than 5.

(2 marks)

14. Update the diagnosis into Stomach Cancer for Patient ID = 222.

(2 marks)

© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL


CONFIDENTIAL DEC2023/ICT450

15. Update the age for Patient ID = 222 and Patient ID = 444. Both of them is 21.

(2 marks)

END OF SQL EXECISES

© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL

You might also like