Menu

(Solved) : Part 01 1 Create Table Called Employeearchives Columns Employees Table Also New Column Cal Q33161282 . . .

Part 01

1. Create a table called Employee_Archives that has the samecolumns as employees table. It should also have a new column calledPrevious_Manager and a column that is called Update_Date

2. Create a Trigger on table Employees so that every time theemployee manager is updated on table employees, the employee recordis inserted in table Employee_Archives with the current date asUpdate_Date and the old value of Employeesupervisor column asPrevious_Manager.

3. Now give an example of execution. Update theEmployeesupervisor for one of the employees and see if the newentry is inserted correctly in Employee_Archives? What will happenif you update more than one records at the same time (using thesame update commant) – all records should appear inEmployee_Archives?

Part 02

1. In this part we will learn how to use functions:

2. Create a functions that has the Salesperson_id as input andreturns a number that represents the total cost of each orders forthis salesperson. Notice that you will need to multiply theOrder_Qty from table Orderline_T and the Productstandardprice fromtable Product_T to get the total cost of each order.

3. Now use the function: Write a select statement that selectsall the saleperson and the total cost of the orders they have eversold.

Part 03

1. Write a select statement that selects the second highestinvoice_total.

Part 04

In this part we create a small procedure:

1. Write a procedure that has as input the customer_id. Then theprocedure should delete the corresponding customer from tablecustomers.

2. Notice that customer_id is a foreign key on table orders.Therefore the customer cannot be deleted if he has placed orders.To delete a record from customers you should first delete thecorresponding orders and to do that you need to first delete thecorresponding order_details.

3. Now execute the procedure to delete customer with id 1.

Part 05

1. Use the metadata tables for users to count how many tablesand how many indexes you have created in your database.

Expert Answer


Answer to Part 01 1 Create Table Called Employeearchives Columns Employees Table Also New Column Cal Q33161282 . . .

OR