Quantcast
Viewing all articles
Browse latest Browse all 3724

trigger creation (no replies)

Hi all
I need to create a trigger on Entry table. The trigger is activated by the Before Insert event.
for example if a newly inserted row has event_id 101 place 1, and there is a row with event_id 101 and place 1 already existed in the Entry table, the trigger generates a message: Duplicate Event_id 101 Place 1. If the newly inserted event_id and place aren't already present in the Entry table, the message is "No duplication of event_id and place".

here is the ddl
CREATE TABLE IF NOT EXISTS `entry` (
`Event_id` int(11) NOT NULL,
`Place` int(11) DEFAULT NULL
);


INSERT INTO `entry` (`Event_id`, `Place`) VALUES
(101, 1),
(102, 2)

please help me
Thanks

Viewing all articles
Browse latest Browse all 3724

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>