Home Database Mysql Tutorial MySQL定时创建表的SQL语句_MySQL

MySQL定时创建表的SQL语句_MySQL

Jun 01, 2016 pm 01:40 PM
surface plan

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

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Can't exit win11 preview program Can't exit win11 preview program Jun 29, 2023 pm 12:04 PM

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

Huawei P70 directly starts the Pioneer Plan and is officially on sale Huawei P70 directly starts the Pioneer Plan and is officially on sale Apr 19, 2024 pm 01:58 PM

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.

New title: Russia promotes upgrading of microelectronics industry: formulating new plan New title: Russia promotes upgrading of microelectronics industry: formulating new plan Oct 12, 2023 pm 11:05 PM

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

Mass production in 2025, Changan Automobile reveals latest solid-state battery plan Mass production in 2025, Changan Automobile reveals latest solid-state battery plan Dec 03, 2023 pm 08:34 PM

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.

How to implement the statement to view table data in MySQL? How to implement the statement to view table data in MySQL? Nov 08, 2023 pm 01:40 PM

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

How to set read-only permissions on a table in Oracle database? How to set read-only permissions on a table in Oracle database? Mar 06, 2024 pm 03:03 PM

In the Oracle database, setting read-only permissions on tables is a very important operation, which can protect data security and prevent misoperations. The following will introduce how to set read-only permissions on tables in an Oracle database and provide specific code examples. First, we need to understand that in the Oracle database, users obtain permissions on tables through authorization. Table permissions include SELECT (query), INSERT (insert), UPDATE (update) and DELETE (delete) operations. Here we will introduce

Use MySQL to create a recommendation system table to implement the recommendation system function Use MySQL to create a recommendation system table to implement the recommendation system function Jul 02, 2023 am 10:01 AM

Use MySQL to create a recommendation system table to implement the recommendation system function. The recommendation system is a system used to recommend personalized content to users based on their preferences and behaviors. In the recommendation system, the database is a key component, which stores information such as user data, item data, and user-item interaction data. As a commonly used relational database management system, MySQL can be used to create recommendation system tables and implement the functions of the recommendation system. This article will introduce how to use MySQL to create a recommendation system table and demonstrate it through code examples.

How to implement the statement of renaming table in MySQL? How to implement the statement of renaming table in MySQL? Nov 08, 2023 pm 12:11 PM

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

See all articles