MySQL定时创建表的SQL语句_MySQL
bitsCN.com
MySQL定时创建表的SQL语句 -- 查看事件计划SELECT @@event_scheduler -- 打开事件计划 SET GLOBAL event_scheduler = 1 -- 存储过程,每月创建一张表CREATE PROCEDURE create_table()BEGIN declare str_date varchar(16);SET str_date = date_format(now(),"%Y%m"); SET @sqlcmd1 = CONCAT('CREATE TABLE db_mail_message_',str_date,"(apptaskid varchar(100) NOT NULL,taskname varchar(200) NOT NULL,appsenduid varchar(200) NOT NULL,appreceiveuid varchar(100) NOT NULL,sendtime varchar(50) NOT NULL,handletime varchar(50) NOT NULL,url varchar(500) NOT NULL,remark varchar(500) NOT NULL,endtime varchar(50) NOT NULL,imapuid varchar(100) NOT NULL,addstatus int(1) NOT NULL DEFAULT '0',readstatus int(1) NOT NULL DEFAULT '0',deletestatus int(1) NOT NULL DEFAULT '0',completestatus int(1) NOT NULL DEFAULT '0',PRIMARY KEY (apptaskid),KEY db_imapuid_index (imapuid)) ENGINE=MyISAM DEFAULT CHARSET=utf8;");PREPARE p1 FROM @sqlcmd1;EXECUTE p1;DEALLOCATE PREPARE p1;END-- 创建事件:每隔一秒自动调用存储过程CREATE EVENT IF NOT EXISTS e_testON SCHEDULE EVERY 1 SECONDON COMPLETION PRESERVEDO CALL test(); -- 创建事件:每月1号1点自动调用存储过程(未测试)CREATE EVENT if not exists e_test on schedule every 1 MONTH STARTS DATE_ADD(DATE_ADD(DATE_SUB(CURDATE(),INTERVAL DAY(CURDATE())-1 DAY), INTERVAL 1 MONTH),INTERVAL 1 HOUR) on completion preserve do call test();-- 开启事件alter event e_test ON COMPLETION PRESERVE ENABLE;-- 关闭事件alter event e_test ON COMPLETION PRESERVE DISABLE; bitsCN.com

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Zhongguancun News: On the morning of April 18, Huawei suddenly announced that the P70 series of mobile phones are officially on sale under the Pioneer Plan. Friends who want to buy should be prepared to take action. According to past practice, Huawei's flagship mobile phones are very popular and will always be out of stock. . This time the Huawei P70 series has been renamed Pura, which means pure. Previously, Huawei's Yu Chengdong said: Since 2012, Huawei's P series smartphones have been like loyal partners, accompanying hundreds of millions of users around the world to spend countless precious moments and jointly witness the beauty and excitement of life. He deeply felt that the trust and love given by every user who chooses Huawei's P series is tantamount to a powerful driving force, always inspiring Huawei to move forward firmly on the road of innovation. Pura means pure.

Can't exit win11 preview program? When we use the win11 system, the win11 preview program will be launched on the computer for us to use. However, some friends do not want to use this preview program. I hope this preview program can be launched. If you don’t know how to exit, the editor below We have compiled a tutorial guide for exiting the Win11 preview experience program. If you are interested, let’s take a look below! Tutorial guide for exiting the Win11 Insider Program 1. First press the shortcut key "win+i" to enter Windows Settings and click "Update and Security". 2. Then click "Windows Insider Program" in the left taskbar, as shown in the figure. 3. At this point you can see the experience on the right

Title: Statements and specific code examples for viewing table data in MySQL MySQL is an open source relational database management system that is widely used in applications of all sizes. In MySQL, viewing table data is a very basic operation. The following will introduce how to implement this operation through specific statements and code examples. First, we will introduce the statements and specific code examples for viewing table data through the MySQL command line tool. Suppose we have a table named "employees", the following is the pass

According to news on October 12, Russia has made important progress in the field of microelectronics. The Russian Ministry of Industry and Trade recently proposed a new microelectronics development roadmap aimed at improving the country's semiconductor technology level. It is understood that Russian microelectronics companies are currently able to produce chip products with a 130-nanometer process, and their new goal is to achieve large-scale production of 65-nanometer chips in 2026, followed by plans to manufacture 28-nanometer chips domestically in 2027, and in The move to achieve mass production of 14nm chips by 2030 has been highly praised by local experts, who believe that these technological advances will help Russia produce affordable laptops based on open source technologies such as Linux and RISC-V. Last year, the Russian government

According to news on December 3, Changan Automobile recently revealed the latest progress of its solid-state battery plan in its latest investor relations activity record. Changan Automobile is currently actively developing new electrolyte materials for semi-solid batteries and solid-state batteries, as well as key processes. According to our understanding, the company plans to gradually promote the development of solid-state batteries based on vehicle demand, and plans to gradually mass-produce applications from 2025. According to the editor's understanding, Changan Automobile is committed to improving the weight and energy density of batteries in the research and development of solid-state batteries. It is expected to reach 350-500 Wh/kg, and the volume energy density is also expected to reach 750-1000 Wh/L. It is expected that this new type of battery will be fully popularized by 2030. In addition, Changan Automobile is also developing lithium-sulfur batteries.

MySQL is a commonly used relational database management system that supports the operation of renaming tables. Normally, renaming a table carries certain risks, so you should be very careful when performing this operation. In this article, we will explore how to implement the rename table statement in MySQL and provide detailed code examples. In MySQL, you can use the ALTERTABLE statement to rename a table. The following is the basic syntax of the ALTERTABLE rename statement: ALTERTABLEo

According to news on July 6, Apple China has recently made adjustments to its AppleTradeIn redemption plan, bringing good news to old users of Apple devices. According to the editor's understanding, in this plan, the trade-in deduction amount for iPhone, Mac, iPad and other devices has been increased. For iPhone products, the maximum discount amount for iPhone 13 Pro Max is 5,500 yuan, iPhone 13 Pro is 4,900 yuan, iPhone 13 is 3,350 yuan, iPhone 13 mini is 3,000 yuan, while the maximum discount amount for iPhone 12 Pro Max is 3,800 yuan, and the newly released iPhone SE No. The third generation

According to news on April 18, just now, Huawei officially launched the Pioneer Plan of Huawei Pura70 series. Huawei Pura70 Ultra is equipped with the industry's first super zoom periscope camera, allowing users to take incredible close and long-range photos without reducing image quality. This series also has an ultra-high-speed wind speed flash function, breaking the record for shooting speed. These new features allow photographers to get closer when shooting while maintaining high-quality images. The HUAWE IPura70 series is pre-installed with HarmonyOS4.2, providing a more interesting, smart and smooth flagship experience. The Beidou satellite messaging function has been upgraded to support sending picture messages to achieve more expressive communication. The series also supports AIAi
