Question: Homework 4 Trigger (Due Date 10/21) A sale table records product item, price and quantity. Write a update trigger after a new record is inserted,
Homework 4 Trigger (Due Date 10/21) A sale table records product item, price and quantity. Write a update trigger after a new record is inserted, find total price for this sale. create table sales salelD int NOT NULL Primary Key productiD ipt NOT NULL unitPrice dcimal(6,2) NOT NULL quantity int NOT NULL total decimal(6,2) DELIMITER $$ CREATE TRIGGER after sales insert AFTER INSERT ON sales FOR EACH ROW BEGIN Thing to submit 1.The complete Trigger statements. 2. Insert a record in the sales table. A screen shot for the successful execution of the trigger (Select the Sales table). 3. Submit a Word file that contains all the results and screen shot. Home 5 Create composite index In the user table, create an composite index called 'dx ame" with columns Last name and first name Run the following query and record the output result if the the index "id name" is used in the query 1. EXPLAIN SELECTfirst Name, last Name, email FROM users WHERE last Name 'Patterson'; 2.EXPLAIN SELECT first.Name, last-Narme, email FROM users WHERE frst-Name-Patterson": . 3. EXPLAIN SELECT frst Name, last Name, email FROM users WHERE last Name 'any' and first Name 'any' 4. EXPLAIN SELECT first Name, last Name, email FROM users WHERE first Name 'any and ,Name 'any 5. EXPLAIN SELECT first Name, last Name, email FROM users WHERE last Name 'any or first Name - any' 6. EXPLAIN SELECT first Name, last Name email FROM users WHERE last Name= 'any' and first Name. Ste e orfirst name: Mary Please submit the followings: 1. SQL statement to Create the index 2. Answer if the query to use the index or not
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
