Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions 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;
expand button
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
Check Mark
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY