Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help with mysql. HW1.9. Trigger to avail discount on repeated purchases Customers Name Type Customerld FirstName INT VARCHAR(255) LastName VARCHAR(255) Phone Number REAL Purchases

need help with mysql.

image text in transcribed

HW1.9. Trigger to avail discount on repeated purchases Customers Name Type Customerld FirstName INT VARCHAR(255) LastName VARCHAR(255) Phone Number REAL Purchases Name Type Purchaseld INT Customerld INT Productld INT Price INT Products Name Type Productld INT ProductName VARCHAR(255) Brand Name VARCHAR(255) Year Released INT Brands Name Type Brand Name VARCHAR(255) Year Established INT CEO VARCHAR(255) Given the above mobile phone store schema, write a Trigger in SQL that checks if the same customer has purchased the same product before, and if so, it gives the customer 30% discount on the purchase price. This trigger should be executed BEFORE any INSERT operation on the Purchases table. Verify the result by inserting (500, 20, 5, 500) record into the Purchases table. Please do not use DELIMITER. Start with the CREATE statement and use the semicolon as your delimiter. query.sql 1 Restore original file

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions