In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article is to share with you about how to use Navicat to create scheduled tasks in mysql. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article.
CURDATE () function
The CURDATE () / / function returns the current date.
SELECT NOW (), CURDATE (), CURTIME ()
/ / example NOW () CURDATE () CURTIME ()
/ / 2008-12-29 16:25:46 2008-12-29 16:25:46
# interval () function
The INTERVAL () function compares the N values in the list (NMagi N1, N2, N3, and so on). This function if N.
SELECT NOW ()-INTERVAL 24 HOUR
If exists and if not exists
If not exists is if it does not exist, if exists is if it exists.
Use
1. When judging that the database does not exist
If not exists (select * from sys.databases where name = 'database_name')
two。 When judging that the table does not exist
If not exists (select * from sysobjects where id = object_id ('table_name') and OBJECTPROPERTY (id,' IsUserTable') = 1)
3. Judgment column does not exist
If not exists (select * from syscolumns where id=object_id ('table_name') and name='column_name')
Create an event
Conditions:
Delete FROM userInfo WHERE find_Data
/ / Delete data more than 24 hours ago
Definer
Specifies the user account to use when checking access rights while the event is running. The default definer value is the user running the CREATE EVENT statement. (this is the same as DEFINER = CURRENT_USER.) If you give a user value, it should be a MySQL account in 'user_name'@'host_name' format (using the same format as in the GRANT statement). Both user_name and host_name values are required.
Statu
You can create an event but keep it inactive with the DISABLE keyword. Alternatively, you can use ENABLE to specify the default state, which is activated.
ON COMPLETION
Normally, once the event has expired, it will be deleted immediately. You can override this performance by specifying ON COMPLETION PRESERVE. Using ON COMPLETION NOT PRESERVE simply makes the default non-persistent performance clear.
AT
AT timestamp is used for one-time events. It specifies that the event runs only once on the date and time of timestamp, it must contain both date and time, or it must be an expression that resolves to a datetime value. Use + INTERVAL to create an event that occurs sometime in the future related to the current date and time.
EVERY
To repeat actions at regular intervals, you can use an EVERY clause followed by an interval. (+ INTERVAL and EVERY cannot be used together.)
STARTS
The EVERY clause may also contain a non-essential STARTS clause. STARTS is followed by a timestamp value indicating when the action should be repeated, or you can use the + INTERVAL interval to specify the amount of time "from now on".
For example, EVERY 3 MONTH STARTS CURRENT_TIMESTAMP + 1 WEEK means "every three months, a week from now".
ENDS
The EVERY clause can also contain an optional ENDS clause. The ENDS keyword is followed by a timestamp value that tells MySQL when to stop repeating events. You can also use the + INTERVAL interval with ENDS.
For example, EVERY 12 HOUR STARTS CURRENT_TIMESTAMP + INTERVAL 30 MINUTE ENDS CURRENT_TIMESTAMP + INTERVAL 4 WEEK is equivalent to "every twelve hours, starting thirty minutes from now and ending four weeks from now".
Timestamp must be in the future-you can't arrange an event to happen in the past.
The interval interval consists of two parts, quantity and time unit.
The above is how to use Navicat to create scheduled tasks in mysql. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.