Given the following table, on a MySQL server 5.1.22 or newer,
CREATE TABLE t1 (id int, c char(100)) engine=MyISAM;
- Create one set of three triggers that must all be activated BEFORE INSERT.
- Upon insertion of the values (1, 'nothing'), the first trigger should replace 'nothing' with 'something', leaving the number unchanged;
- the second trigger should add ' more ';
- the third trigger should add '!!'.
- Create one set of three more triggers, all activated BEFORE INSERT.
- Upon insertion of the values (1,'nothing') the first trigger should add 10 to the number, leaving the text unchanged.
- the second trigger should add 100 to the number;
- the third trigger should add 1000 to the number;
- You can only use one MySQL server. No replication, no cluster;
- You can't use MySQL Proxy;
- The only routines you can create are TRIGGERs. No PROCEDUREs, FUNCTIONs, or EVENTs.
- The solution must work with a standard binary. No code changes;
- Each insert statement must result in the creation of one and only one record in table t1.
- No intermediate records should be created in t1 or other tables.
- All three triggers must fire automatically as a result of a single INSERT statement.
Since I am traveling (I am about to board a plane from L.A. to Sydney), don't expect a quick reaction from me. I will eventually acknowledge your comments. Just be patient and don't assume I ran away.
The above instructions are accurate, but kind of devious (of course, or else you would not enjoy the quiz). Good luck!