Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MySQL: Trigger Insert (1) I have a table with field1 field2 ... fieldN (2) How do I write a MySQL query such that an insert
MySQL: Trigger Insert
(1) I have a table with
field1
field2
...
fieldN
(2) How do I write a MySQL query such that an insert trigger enforces the following constraints:
field1 = '1', '2', ... '10'
field2 is between '1000' and '2000'
(3) The trigger should ```SIGNAL SQL STATE 45001``` and return a message explaining why the insert is invalid for a constraint violation. For example: "field1" is not in desired range"
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started