1. Create a database test1 in mysqlStatement: create database test12. Create a table examinfoCreate table examinfo (Id int auto_increment not null,Endtime datetime,Primary key (id));3. insert data:Insert into examinfo values ('1', '2017-4-23 23:26:50
Create event creates execution eventsCREATE[definer = {User | Current_User}]EVENT[IF not EXISTS]Event_NameOn SCHEDULE SCHEDULE[on completion [NOT] preserve]--whether the server retains time when the event is completed. Default is not reserved[ENABLE
I. BACKGROUNDThe interface operation log is stored in the Operationlog table in the MySQL database, and if the table cannot be backed up automatically, the data in the table becomes more and more, affecting the speed. You can periodically back up
Mysql regularly calls the stored procedure to back up the table structure. example: CREATEPROCEDUREbackUpSms () BEGINDECLAREtnamevarchar (64); set @ tnameCONCAT (39; sms_accpet39;, DATE_FORMAT (NOW (), 39 mysql regularly calls the stored procedure
First, the basic conceptThe mysql5.1 version begins with the introduction of the event concept. Event is not only a "time trigger", unlike the events triggered by the triggers, the event is similar to a Linux crontab scheduled task for time
Business needs, the app user is written to a log table App_open_log.On the line for 7 months, there are 740,000 records.Now consider the sub-database of the table. At the beginning of each month, create a database table prefixed by App_open_log_
Create MySql stored procedures and triggers (Lite version) bitsCN.com
1. CREATE a stored procedure delimiter // drop procedure if exists 'proc _ test' // create procedure 'proc _ test' (TABLE_NAME VARCHAR (20), num int) begin select * FROM
MySQL periodically calls the stored procedure to back up the table data set table structureStored Procedure instance:CREATE PROCEDURE backupsms () begindeclare tname varchar (+), set @tname = CONCAT (' Sms_accpet ', Date_format (now (), '%y%m ') Set
There are many SQL syntax, which is a complete language. This only implements a function, does not do in-depth research.Target: Update the table regularly or clear the table.Case: A task that has been timed to empty the position information table.
What is a stored procedure:A stored procedure can be said to be a recordset, which is a block of code consisting of some T-SQL statements that implement functions like a method (to and from a single table or multiple tables), and then give the code
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.