Question: 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
Get step-by-step solutions from verified subject matter experts
