Trigger 1

Trigger

mysql> SET @sum = 0;
mysql> INSERT INTO account VALUES(137,14.98),(141,1937.50),(97,-100.00);
mysql> SELECT @sum AS 'Total amount inserted';
+-----------------------+
| Total amount inserted |
+-----------------------+
|               1852.48 |
+-----------------------+

Here is what the above code is Doing:
1. The first line sets the variable @sum to 0.
2. The second line inserts three rows into the account table.
3. The third line displays the value of the @sum variable.

Similar Posts