MySQL添加当前时间

2013-12-06 15:01:03

[工作记录 | Work Record] , ,

SQL提供了一个函数可以直接添加当前时间,不需要在生成SQL语句之前对时间这个值进行操作.

 

可以省下一定运算量,以免忘记,还是记下来比较好.

 

函数名 now()

 

 

例子:

 

INSERT INTO `database_name`.`table_name` (`ID`, `username`, `ip`, `visit_time`)
VALUES (NULL, 'asdf', '127.0.0.1', NOW());

 

 

 

 

这篇博文发表在 工作记录 | Work Record 目录下,标签为 , ,
如需引用,请使用链接:https://note.mc256.dev/?p=153

This article published in 工作记录 | Work Record with tags , , .
Cite this page using this link:https://note.mc256.dev/?p=153

您的邮箱地址不会被公开,评论使用Gravatar头像。
Your email address will not be published. This blog is using Gravatar.

正在提交评论... Submitting ...
正在为您准备评论控件 Loading Comment Plugin
Copyright © 2013-2024 mc256. All Rights Reserved.
Powered by WordPress on top of a dual-stack k3s Cluster using JuiceFS.
Wordpress Theme Designed By mc256.
Encrypted By Let's Encrypt.  Hosted On Linode + OVH + AWS.
DNS Provided By Hostker.
Status Page by CloudFlare Worker.