Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Employees (employeeNumber, lastName, firstName, DOB, HireDate, Position, Salary, Dept) Primary Key: employeeNumber Foreign key: Dept refers to Dept ID in Departments Departments (Dept ID,
Employees (employeeNumber, lastName, firstName, DOB, HireDate, Position, Salary, Dept) Primary Key: employeeNumber Foreign key: Dept refers to Dept ID in Departments Departments (Dept ID, DeptName, DeptLocation) Primary Key: Dept ID (2 marks) Consider the following MySQL stored procedure: CREATE PROCEDURE Find EmployeeNo( IN fName CHAR (30), IN 1Name CHAR (30), BEGIN SELECT employeeNumber INTO employeeNo FROM employees WHERE fName = firstName AND 1Name= last Name; END OUT employeeNumber INT(10)) Discuss the two error conditions you may come across as a result of the execution of the procedure. You may use the following procedure call to explain your answer: CALL Find EmployeeNo ('Justin', 'Thyme', ON). (4 marks) Modify the procedure Find EmployeeNo given in (a) above so that neither error you have identified above results in the abrupt termination of the execution of the procedure body. (4 marks) Write a trigger to enforce the following business rule: cach department has only one manager. You may use the following trigger template for ensuring this business rule while new rows are inserted into Employees: CREATE TRIGGER TR_MANAGER BEFORE INSERT ON Employees FOR EACH ROW BEGIN END
Step by Step Solution
There are 3 Steps involved in it
Step: 1
CREATE DEFINERrootlocalhost PROCEDURE FindEmployeeNoIN fName CHAR30 IN lName CHAR30 OUT employeeNo I...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started