1 answer

QUESTION B1. (7 marks) This question assumes the following relational schema Employee (employeeNumber, lastName, firstName, DOB,...

Question:

QUESTION B1. (7 marks) This question assumes the following relational schema Employee (employeeNumber, lastName, firstName, DOB, HireDate, Position Salary, Dept) Primary Key: employeeNumber Foreign key: Dept refers to DeptID in Department Department (DeptID, DeptName, DeptLocation) Primary Key: DeptID You have been given the following MySQL stored procedure: CREATE PROCEDURE Find_EmployeeName (IN employeeNo INT (11), OUT employeeName VARCHAR (60)) BEGIN SELECT concat(firstName, , lastName) INTO employeeName FROM employees WHERE employeeNumber employeeNo; END (a) (2 marks) Name the two types of parameters that have been used in the declaration of (b) (2 marks) What is a trigger? Explain how triggers can be used to enhance data (c) (3 marks) Create a stored procedure that takes the department name as an input and the procedure Find EmployeeName. List at least one characteristic of each type integrity? prints the details of all the employees who are currently working for the department You may use the following procedure template CREATE PROCEDURE Find_Employee (IN deptName VARCHAR (50)) BEGIN DECLARE empRec CURSOR FOR OPEN empRec; REPEAT END REPEAT; CLOSE empRec; END

QUESTION B1. (7 marks) This question assumes the following relational schema Employee (employeeNumber, lastName, firstName, DOB, HireDate, Position Salary, Dept) Primary Key: employeeNumber Foreign key: Dept refers to DeptID in Department Department (DeptID, DeptName, DeptLocation) Primary Key: DeptID You have been given the following MySQL stored procedure: CREATE PROCEDURE Find_EmployeeName (IN employeeNo INT (11), OUT employeeName VARCHAR (60)) BEGIN SELECT concat(firstName, '', lastName) INTO employeeName FROM employees WHERE employeeNumber employeeNo; END (a) (2 marks) Name the two types of parameters that have been used in the declaration of (b) (2 marks) What is a trigger? Explain how triggers can be used to enhance data (c) (3 marks) Create a stored procedure that takes the department name as an input and the procedure Find EmployeeName. List at least one characteristic of each type integrity? prints the details of all the employees who are currently working for the department You may use the following procedure template CREATE PROCEDURE Find_Employee (IN deptName VARCHAR (50)) BEGIN DECLARE empRec CURSOR FOR OPEN empRec; REPEAT END REPEAT; CLOSE empRec; END

Answers

Question B1

a) The two types of parameters that have been used in the declaration of the procedure are the IN parameter and the OUT parameter.

    IN parameter:

                   These types of parameters are used to send values to stored procedures. This type of parameter is a read only parameter. We can assign the value of IN type parameter to a variable or use it in a query, but we cannot change its value inside the procedure.

   OUT parameter:

          The OUT parameters are used to send the OUTPUT from a procedure or a function. This is a write-only parameter i.e, we cannot pass values to OUT parameters while executing the stored procedure, but we can assign values to OUT parameter inside the stored procedure and the calling program can receive this output value.

b) A trigger is a procedure that is automatically invoked by the DBMS in response to specified changes to the database.

    Data Integrity: This refers to the accuracy and consistency of data stored in a database, data warehouse, data mart or other construct.

Triggers help to enhance data integrity when there is a referential integrity constraint on the tables or data we are working with and these tables are present in different nodes or servers.

Example: consider a medicine ordering system which contains data from two different servers say server ‘A’ and server ‘B’

Server A contains a database which consists of the tables that store details about the customer orders and the status of order.

Server B contains a database that stored the details about the orders ,products ordered, their availability.

   And suppose a product is not available in the stock then the order that is placed for that product is deleted in the server B. So, when the order is deleted in the server B then the order deletion must also reflect in orders status in the the server A so that the data integrity is maintained.otherwise the customer will be waiting for the completion of that order.So here in such cases we use TRIGGERS to enhance data integrity by creating a trigger that updates the order status in the server A whenever a deletion of order happens in server B.

.

Similar Solved Questions

1 answer
Identify the organism? which arrow indicates the location of the eggs in this organism? Slide 5...
identify the organism? which arrow indicates the location of the eggs in this organism? Slide 5 A B Notes Comments - MacBook 20 00 F7 DII FB DD F9 FS F6 F10 F11 % 1 & ) 5 6 7 8 9 O -...
1 answer
5. A commercial refrigerator uses 134a refrigerant to keep the space refrigerated at −30 ° C...
5. A commercial refrigerator uses 134a refrigerant to keep the space refrigerated at −30 ° C by rejecting its waste heat into cooling water entering the condenser at 101,325 kPa, at the rate of 0.25 kg / s. The refrigerant is fed to the compressor at -25 ° C and 100 kPa. Use a software...
1 answer
Exercise 10. Write A = 1-3 6 01 as the sum of a symmetric matrix B...
Exercise 10. Write A = 1-3 6 01 as the sum of a symmetric matrix B and a skew-symmetric matrix C. SVImImetric matrIX C...
1 answer
Discussion: Determine the synchronous reactance by neglecting the armature resistance ? How does the phase voltage...
Discussion: Determine the synchronous reactance by neglecting the armature resistance ? How does the phase voltage behave in case of ohms load, inductive load and capacitive load of synchronous generator? How can be control the terminal voltage to the rated voltage of synchronous generator?...
1 answer
Table 1: Pepita Disco Performance, 2011 (UYU in millions) Units sold 100 million units Revenue 200...
Table 1: Pepita Disco Performance, 2011 (UYU in millions) Units sold 100 million units Revenue 200 Variable costs Materials 30 Direct labor(manufacturing,sales) 40 Opearational costs(manufacturing,inventory,delivery) 30 Other variable costs 20 Margin on Sales 80 Fixed Costs Ma...
1 answer
A client is seen in the emergency room for a possible fractured wrist from a fall...
A client is seen in the emergency room for a possible fractured wrist from a fall on the ice. The client tells the nurse that he has not been able to straighten the fingers of the injured hand/ wrist. What is the nurse's best action when hearing this? 1. Apply ice to the affected arm to reduce p...
1 answer
3. (25 points total) Given is the matrix A-0 5 0 L-2 07 (a) (5 points)...
3. (25 points total) Given is the matrix A-0 5 0 L-2 07 (a) (5 points) Find the eigenvalues of A. Label the eigenvalues as follows: λι Az Az (b) (5 points) As you might have seen (in class), for any matrix n × n matrix A the following properties hold: Det A Π, λ,, î...
1 answer
The Internal Revenue Service (IRS) provides a toll-free help line for taxpayers to call in and...
The Internal Revenue Service (IRS) provides a toll-free help line for taxpayers to call in and get answers to questions as they prepare their tax returns. In recent years, the IRS has been inundated with taxpayer calls and has redesigned its phone service as well as posting answers to frequently ask...
1 answer
How do you simplify #-[ 4- ( 5- x ) ]#?
How do you simplify #-[ 4- ( 5- x ) ]#?...
1 answer
We were unable to transcribe this imageIt's all one problem (or at least all one region), but there's a few things to do with it. Consider the region bounded by the graphs of x-3-y In the...
We were unable to transcribe this imageIt's all one problem (or at least all one region), but there's a few things to do with it. Consider the region bounded by the graphs of x-3-y In the way that's shown below (there's other regions bounded by those functions too, but we're look...
1 answer
X is a Laplace Distribution (Double Exponential Distribution) with mu = beta and b = alpha....
X is a Laplace Distribution (Double Exponential Distribution) with mu = beta and b = alpha. f(x) = where alpha > 0 Derive an Expression for E(|X - E(X)|). (The expected value of the absolute value of X - the mean)....
1 answer
Upll plovided. Note the separate page of "SLO" questions. You l page of notes. Q1 Over the alphabet -(a,b), the...
upll plovided. Note the separate page of "SLO" questions. You l page of notes. Q1 Over the alphabet -(a,b), the language is the set of all strings of length 5. For pression below, list one string in 2 that satisfies that expression, and one that does not. If that is impossible, write "im...
1 answer
A cylindrical non-magnetic wire, radius R, carries a uniform steady current I. Find H inside and...
A cylindrical non-magnetic wire, radius R, carries a uniform steady current I. Find H inside and outside the wire. If the current is 30 kA, what is the field in T at a distance of 1 m?...
1 answer
What value(s) of Durbin–Watson statistic indicate(s) no autocorrelation is present? 2 ± 1.96 0 and 4...
What value(s) of Durbin–Watson statistic indicate(s) no autocorrelation is present? 2 ± 1.96 0 and 4 1...
1 answer
Novak Company began operations in 2019 and determined its ending inventory at cost and at lower-of-LIFO...
Novak Company began operations in 2019 and determined its ending inventory at cost and at lower-of-LIFO cost-or-market at December 31, 2019, and December 31, 2020. This information is presented below: Lower-of-Cost-or- Market $357,400 371,940 Cost $375,880 386,720 12/31/19 12/31/20 (a) Prepare the j...
1 answer
A first-order reaction has rate constants of 1.5 ✕ 10-2 s-1 and 7.8 ✕ 10-2 s-1 at 0°C and 20.°C, respectively. What is the value of the activation energy?
A first-order reaction has rate constants of 1.5 ✕ 10-2 s-1 and 7.8 ✕ 10-2 s-1 at 0°C and 20.°C, respectively. What is the value of the activation energy?...
1 answer
In March 2018, thel Board of Directors of Token Limited declared a cash dividend, payable the...
In March 2018, thel Board of Directors of Token Limited declared a cash dividend, payable the first of April. Required: Prepare a residual analysis for the dividend declaration in March In your analysis, include a discussion of the accounts debited and credited....
1 answer
Suppose you plan flipping a coin twice where the probability p of heads has the density...
Suppose you plan flipping a coin twice where the probability p of heads has the density function f(p) = 6p(1 - p), 0 < p < 1. Let Y denote the number of heads of this “random” coin. Y given a value of p is Binomial with n = 2 and probability of success p. a. Write down the joint de...