Write SQL code for the following: Create a stored procedure “setRelocationFee” to set the relocation fee for a given employee. If the employee’s office is in San Francisco, the relocation fee is $10000; if the employee’s office is in Boston, the relocation fee is $8000; if the employee’s office is in London, the relocation fee is $20000; if the employee works in other offices, the relocation fee is $15000.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Write SQL code for the following:

Create a stored procedure “setRelocationFee” to set the relocation fee for a given
employee. If the employee’s office is in San Francisco, the relocation fee is $10000; if
the employee’s office is in Boston, the relocation fee is $8000; if the employee’s office
is in London, the relocation fee is $20000; if the employee works in other offices, the
relocation fee is $15000.  

(see image for table structure)

I am stuck for the part that I have to select employeeNumber and officeCode and set the relocationFee to be able to obtain the result but I do not know how. Bellow is what I have gotten. 

Delimiter|

CREATE PROCEDURE setRealocationFee(IN EmployeeID INT(11), OUT realocationFee INT(5))

CREATE TABLE `offices' (
'officeCode' varchar(10) NOT NULL,
`city' varchar(50) NOT NULL,
'phone' varchar(50) NOT NULL,
addressLine1 varchar(50) NOT NULL,
addressLine2 varchar(50) DEFAULT NULL,
'state varchar(50) DEFAULT NULL,
'country' varchar(50) NOT NULL,
`postalCode' varchar(15) NOT NULL,
'territory' varchar(10) NOT NULL,
PRIMARY KEY (`officeCode")
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE 'employees' (
employeeNumber' int(11) NOT NULL,
`lastName' varchar(50) NOT NULL,
'firstName' varchar(50) NOT NULL,
'extension` varchar(10) NOT NULL,
`email` varchar(100) NOT NULL,
'officeCode' varchar(10) NOT NULL,
reportsTo` int(11) DEFAULT NULL,
`jobTitle` varchar(50) NOT NULL,
PRIMARY KEY (`employeeNumber'),
KEY 'reportsTo` (`reportsTo'),
KEY 'officeCode' ('officeCode'),
March 9, 2023 at 11:22 PM
CONSTRAINT 'employees ibfk 2` FOREIGN KEY (`officeCode') REFERENCES offices` (`officeCode'),
CONSTRAINT `employees ibfk1` FOREIGN KEY (`reportsTo`) REFERENCES employees' ('employee Number')
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Transcribed Image Text:CREATE TABLE `offices' ( 'officeCode' varchar(10) NOT NULL, `city' varchar(50) NOT NULL, 'phone' varchar(50) NOT NULL, addressLine1 varchar(50) NOT NULL, addressLine2 varchar(50) DEFAULT NULL, 'state varchar(50) DEFAULT NULL, 'country' varchar(50) NOT NULL, `postalCode' varchar(15) NOT NULL, 'territory' varchar(10) NOT NULL, PRIMARY KEY (`officeCode") ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE 'employees' ( employeeNumber' int(11) NOT NULL, `lastName' varchar(50) NOT NULL, 'firstName' varchar(50) NOT NULL, 'extension` varchar(10) NOT NULL, `email` varchar(100) NOT NULL, 'officeCode' varchar(10) NOT NULL, reportsTo` int(11) DEFAULT NULL, `jobTitle` varchar(50) NOT NULL, PRIMARY KEY (`employeeNumber'), KEY 'reportsTo` (`reportsTo'), KEY 'officeCode' ('officeCode'), March 9, 2023 at 11:22 PM CONSTRAINT 'employees ibfk 2` FOREIGN KEY (`officeCode') REFERENCES offices` (`officeCode'), CONSTRAINT `employees ibfk1` FOREIGN KEY (`reportsTo`) REFERENCES employees' ('employee Number') ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY