mysqldate如何插入null

首页 编程分享 DB丨SERVICE 正文

coldplay.xixi 转载 编程分享 2020-11-18 23:02:05

简介 mysql date插入null的方法:首先连接到MySQL服务器;然后使用use关键字,完成选库操作;最后date数据类型中插入一个NULL,代码为【insert into user (time) values (null)】。


更多相关免费学习推荐:(视频)

mysql date插入null的方法:

1、首先通过客户端连接到MySQL服务器,示例:

mysql -u user -p

2、使用use关键字,完成选库操作,示例:

use 数据库名;

3、创建一张简易表,其中date时间格式支持NULL赋值,示例:

create table user(
id int(10) auto_increment primary key,
time date);

4、想time字段中的 date 数据类型中插入一个NULL,示例:

insert into user (time) values (null);

5、查询一下,Date数据类型中成功插入一个NULL,示例:

select * from user;

转载链接:http://www.php.cn//mysql-tutorials-463758.html


Tags:


本篇评论 —— 揽流光,涤眉霜,清露烈酒一口话苍茫。


    声明:参照站内规则,不文明言论将会删除,谢谢合作。


      最新评论




ABOUT ME

Blogger:袅袅牧童 | Arkin

Ido:PHP攻城狮

WeChat:nnmutong

Email:nnmutong@icloud.com

标签云