Question: Create a procedure that adds a user. The procedure takes the five parameters of dept_no, birth_Date, first_name, last_name, and gender, as defined below. CREATE PROCEDURE

Create a procedure that adds a user. The procedure takes the five parameters of dept_no, birth_Date, first_name, last_name, and gender, as defined below.

CREATE PROCEDURE `addUser`(dept_no char(4), birth_date date, first_name varchar(14), last_name varchar(14), gender char)

The procedure consists of the steps:

Generate a new employee number finding the highest emp_no and add one. I.e., new_emp_no = select max(emp_no) + 1 from employees

Insert the new user into Table employees, where use CURDATE() for hire_date.

Insert (new_emp_no, dept_no) into dept_emp, where use CURDATE() for from_date and '9999-01-01' for to_date.

You can test the procedure like "call addUser('d001', '1998-01-01', 'FirstName', 'LastName', 'M');".

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!