Home > database >  Can you tell me whether the events of the MySQL support multiple statements at the same time
Can you tell me whether the events of the MySQL support multiple statements at the same time

Time:10-03

I wrote two statements in the event, once again opened the event is only the first statement, the back of the statements are automatically cleared, with Navicat,
Mysql support multiple statements an event, please?
 
Truncate table TB;
Insert into TB (aaa, BBB)... ;

CodePudding user response:

Use the begin... End wrapped up

CodePudding user response:

Start the transaction;
Your DML statements
commit;

CodePudding user response:

1st floor is right to say:
 
Delimiter |

The CREATE EVENT e_daily
ON the SCHEDULE
EVERY DAY 1
The COMMENT 'Saves the total number of sessions then clears the table each day'
DO
The BEGIN
INSERT INTO site_activity. The totals (time, total)
The SELECT CURRENT_TIMESTAMP, COUNT (*)
The FROM site_activity. Sessions;
The DELETE FROM site_activity. Sessions;
END |

Delimiter.
  • Related