Employees (employeeNumber, lastName, firstName, DOB, HireDate, Position, Salary, Dept) Primary Key: employeeNumber Foreign key: Dept refers...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Answer rating: 100% (QA)
CREATE DEFINERrootlocalhost PROCEDURE FindEmployeeNoIN fName CHAR30 IN lName CHAR30 OUT employeeNo I... View the full answer
Related Book For
Posted Date:
Students also viewed these databases questions
-
Locate Snapchat's online "Terms of Service" or similar legal contract that applies to a user on their platform or service. Read it thoroughly and note a specific aspect or item in the contract that...
-
Use the convolution theorem to find the inverse Laplace transform of the given function. 11s +121 (s+121)2 L-1 11s+ 121 {(s + 121) }
-
The Crazy Eddie fraud may appear smaller and gentler than the massive billion-dollar frauds exposed in recent times, such as Bernie Madoffs Ponzi scheme, frauds in the subprime mortgage market, the...
-
Three friends are choosing a restaurant for dinner. Here are their preferences: a. If the three friends use a Borda count to make their decision, where do they go to eat? b. On their way to their...
-
It is desired to solve Prob. 6.62 for the most economical pump and cast-iron pipe system. If the pump costs $125 per horsepower delivered to the fluid and the pipe costs $7000 per inch of diameter,...
-
Crankshaft Company manufactures equipment. Crankshaft's products range from simple automated machinery to complex systems containing numerous components. Unit selling prices range from $200,000 to...
-
Blade or diagram efficiency is defined as the ratio of _____ to _____
-
Silver Corporation has 2,000 shares of common stock outstanding. Howard owns 600 shares, Howards grandfather owns 300 shares, Howards mother owns 300 shares, and Howards son owns 100 shares. In...
-
What does the Performance Management (PM) process consist of? On what motivational theory is the PM process based on?
-
In December, Northern Kiteboarding magazine collected $80,000 for subscriptions for the next calendar year. The company collects cash in advance and then downloads the magazines to subscribers each...
-
Translate the machine code given below to assembly code and specify the addressing mode used by each instruction. 0x21F20064 0x3333FFFF 0x03B18004 0x1109FFFC 0x08100000
-
What is FinTech? Conduct research to explore and share some primary benefits, risks, and challenges associated with using AI-based FinTech solutions in Canadian financial markets. How can Canada...
-
You are the merchandise manager for Best Buy electronics and have been asked to expand the assortment of music products. Industry trends suggest more people are downloading their music online. How...
-
A sound wave has a frequency of 663 Hz in air and a wavelength of 0.48 m. What is the temperature of the air? Relate the speed of sound in air to temper- ature in units of Kelvin, but answer in units...
-
A geosynchronous satellite is a satellite orbiting the Earth above a fixed point at the equator of the Earth. It is known that the gravitational acceleration due to Earth at a distance r from the...
-
In a 'XYZ' Bank, the loan department needs to predict if the customer will apply for * a housing loan or not. Given past data of customers. Identify the feature which would be the split note in...
-
Let F(x) = 70 sint di 1 Show that Evaluate F(1) to three decimal places. F(x) = x- x3 + 3.3! 5.5! x7 7.7! +...
-
d. The characteristic equation of a control system is given by s+2s+8s+12s+20s+16+16=0. Determine the number of the roots of the equation which lie on the imaginary axis of s-plane
-
When you place a table into third normal form, you have eliminated __________ . a. Transitive dependencies b. Partial key dependencies c. Repeating groups d. All of the above
-
Design the logic for a program that outputs every number from 1 through 20 along with its value doubled and tripled.
-
A consignment shop accepts a product for sale and sets an initial price. Each month that the item doesnt sell, the price is reduced by 20 percent. When the item sells, the items owner receives 60...
-
Verify that the log-likelihood of model (7.7) is \(\sum_{i=1}^{k}\left[n_{i} \lambda-\exp (\lambda) ight]\). (a) Compute MLE of \(\lambda\). (b) Compute the Pearson chi-square statistic and compare...
-
Think about the general concept of a relationship, not necessarily in a business setting, but just relationships in general between any two parties. What aspects of relationships are inherently...
-
Has transactional selling gone the way of the dinosaur? That is, are there ever any situations in which a transactional approach to selling would be an appropriate approach today? If so, what are...
Study smarter with the SolutionInn App