Answered step by step
Verified Expert Solution
Link Copied!

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: 

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Programming Logic & Design Comprehensive

Authors: Joyce Farrell

8th Edition

1285776712, 978-1285776712

More Books

Students also viewed these Databases questions

Question

25.0 m C B A 52.0 m 65.0 m

Answered: 1 week ago