MySQL Forums
Forum List  »  Triggers

Re: Using Sequel Pro and keep getting syntax errors for my trigger...
Posted by: Peter Brawley
Date: December 20, 2017 10:18AM

After creating the tables as you've defined them, this ...

Create Trigger a_players_after_ins
After Insert On a_players
For each row Insert into `wp_terms` set `name` = Concat(NEW.nameFirst,' ',NEW.nameLast);

... executes without error. Note that Begin...End aren't needed (and therefore Delimiter directives aren't needed either) because the Trigger is just one logical line.

However the tables and the Trigger are problematic ...

(i) neither table has a primary key; without a PK, such a table isn't a real table, eg you won't be able to edit it.

(ii) the wp_terms.name column is entirely redundant---the info it contains is already in the a_players table. To display a formatted name of the sort your Trigger creates, use its Concat() in a query, or create a View for it.

You need to stop what you're doing till you've absorbed the basics of relational database design. The web has many such tutorials.



Edited 1 time(s). Last edit at 12/20/2017 11:20AM by Peter Brawley.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.