Question 6
[4 Marks]
Compare the use of a cursor and a regular SELECTstatement for iterating over a result set.
Question 7
[4 Marks]
Compare the FETCHNEXTstatement and the OPENstatement in the context of cursors.
Question 8
Compare implicit and explicit transactions in SQLServer.
[5 Marks]
Section B - Practical (60 Marks)
(NOTE: Use SQL Server Management System (SSMS) on your computer for 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]
Scenario 1: Basic Parameterized Stored Procedure
CREATE TABLE Employees (
EmployeeID INT PRIMARY KEY,
FirstName VARCHAR(50),
LastName VARCHAR(S0),
Salary INT,
JobTitle VARCHAR(50)
);
INSERT INTO Employees (EmployeeID, FirstName,
VALUES
(1, 'John', 'Doe', 50000, 'Engineer'),
(2, 'Jane',
'Smith',
60000, 'Manager'),
(3, 'Bob', 'Johnson',
75000, 'Developer');
LastName, Salary, JobTitle)
Please create a stored procedure that utilizes the "Employees" table, along with the
provided sample values, to retrieve employees whose salary exceeds a specified amount.
Question 2
[5 Marks]
Scenario 2: Using IF Statement in Stored Procedure
Modify the stored procedure created in Question 1 to include a condition that filters
employees with a specific job title.
Question 3
[2 Marks]
Scenario 3: Handling Default Parameter Values
Modify the stored procedure from Question 2 to make the job title parameter optional,
assigning it a default value.
3