DPG621S - DATABASE PROGRAMMING PRACTICAL - 1ST OPP - NOV 2022


DPG621S - DATABASE PROGRAMMING PRACTICAL - 1ST OPP - NOV 2022



1 Page 1

▲back to top


nAmI BIAunIVE Rs ITY
OF SCIEn CE Ano TECHn OLOGY
FACULTY OF COMPUTING AND INFORMATICS
SCHOOL OF COMPUTING
DEPARTMENTOF SOFTWAREENGINEERING
QUALIFICATION: BACHELOROF COMPUTERSCIENCE;BACHELOROF INFORMATICS;BACHELOR
OF GEOINFORMATION TECHNOLOGY
QUALIFICATION CODE: 07BCMS; 07BACS
07BAIT; 07BAIF; 07GITB
LEVEL: 6
COURSE: DATABASEPROGRAMMING
COURSE CODE: DPG621S
DATE: NOVEMBER 2022
SESSION: 2 (PRACTICAL)
DURATION: 2 HOURS
MARKS: 60
EXAMINER:
MODERATOR:
FIRST OPPORTUNITY EXAMINATION QUESTION PAPER
MR GEREONKOCH KAPUIRE
PROFJOSEQUENUM
THIS QUESTION PAPER CONSISTS OF 2 PAGES
(Excluding this front page)
INSTRUCTIONS
1.
Answer all questions.
2.
When writing take the following into account: The style should inform than impress, it
should be formal, in the third person, paragraphs set out according to ideas or issues
and the paragraphs flow.in a logical order. The information provided should be brief and
accurate.
3.
Please, ensure that your writing is legible, neat and presentable.

2 Page 2

▲back to top


3 Page 3

▲back to top


SectionB- Practical(60 Marks)
(UseSQLServer Management System(SSMS}on your computerfor this section)
Instructions: Copy and Paste your final code onto notepad and save it on the exam drive (z).
The drive is the drive with your student number.
Question 1
[4 Marks]
Create a table named EMPLOYEE_SALARuYsing the fields (Employee_/0, LastName, FirstName,
Title, Salary, and Gender). Choose relevant data types and include one primary key.
Question 2
[10 Marks]
Write statements to create a procedure that adds an employee record (The value of
Employee_ld is 1, while the rest of the values are your choice) to the EMPLOYEE_SALARtYable.
Make use of variables to INSERTthe values rather than hardcoded values. Create a statement to
invoke the procedure, and a statement to verify that the employee was successfully added.
Question 3
[7 Marks]
Write a statement to modify the procedure created in Question 2. Make use of parameters to
add an employee record (The value of Employee_ld is 2, while the rest of the values are your
choice) to the EMPLOYEE_SALARtYable. Create a statement to invoke the procedure, and a
statement to verify that the employee was successfully added.
Question 4
[10 Marks]
Write a statement to create a procedure that accepts an Employee ID as input. Two conditions
should be added: firstly test if the first Employee ID entered in Question 2 matches the value
inputted, and their salary is incremented with a 500 bonus, and the bonus is printed; Secondly
test in the second Employee ID entered in Question 3 matches the value inputted, and their
salary in incremented with 1000 bonus, and the bonus is printed.
Invoke the procedure to test the procedure.
Question 5
[7 Marks]
Write a statement to create a procedure that accepts an input value. Two conditions should be
tested for the values Mr and Dr. If none of the values are met, display the text "The title does not
exist". Invoke the procedure to test the procedure.
Question 6
[2 Marks]
Transform the procedure written in Question 5 to demonstrate the usage of XML.
Question 7
[7 Marks]
Write a statement to display the title of the employees five times. Please do not retype the
same statement. Invoke the procedure to test the procedure.
2

4 Page 4

▲back to top


5 Page 5

▲back to top


Question 8
[5 Marks]
Write a statement to create a trigger. Print a message to the employee when anyone tries to add
data to the Employee_Salary table. Create a statement to verify that the trigger is fired
successfully.
Question 9
Write a statement to disable the trigger created in Question 8.
[2 Marks]
Question 10
[6 Marks]
Write a statement to create a procedure that performs transactions. The statement must update
the gender of the employee created in Question 2; perform a ROLLBACKTRANSACTION.Create
a statement to verify whether the transaction was successful or not.
<<<<<<End of Practical Exam Memo>>>>>
3

6 Page 6

▲back to top


nF1mlB!A
UOIV!:RSITY
0 F Si;lEl1CEAf10
TH.H110LOGY
P/13ag13,8(!
Windhoek
flAMIBIA
2022-10-18
fACULTVOFCOMPUTIN&GINFORMATICS
,!l':PtiRTMl:NCTO: MPUTESRCIENCE