mysql 中,如何把datetime字段,改成 date 字段,用什么函数? date_formate(fieldName, "%Y-%m-%d"); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 mysql> describe hello;+-----------+----------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+-----------+----------+------+-----+---------+-------+| date | date | YES | | NULL | || date_time | datetime | YES | | NULL | |+-----------+----------+------+-----+---------+-------+2 rows in set (0.13 sec)mysql> select * from hello;+------------+---------------------+| date | date_time |+------------+---------------------+| 2004-01-07 | 2004-01-07 17:44:06 || NULL | 2003-11-12 00:01:00 |+------------+---------------------+2 rows in set (0.05 sec)mysql> alter table hello change date_time date_time date;Query OK, 2 rows affected (0.22 sec)Records: 2 Duplicates: 0 Warnings: 0mysql> select * from hello;+------------+------------+| date | date_time |+------------+------------+| 2004-01-07 | 2004-01-07 || NULL | 2003-11-12 |+------------+------------+2 rows in set (0.00 sec)mysql> 临时磁盘文件需要多大的空间 触发器调用存储过程提示错误 mysql存储过程问题 MySQL数据库中存放的int类型,在程序中获取为uint问题 MySQL插入数据库的瞬间时区改变 求教远程连接Postgresql 的代码 myOdbc不能连接Mysql 418的问题 mysql做小系统在公司内部使用,要收费吗? 对于删除表中一行数据的处理 求这个sql 怎么写? postgresql +JDBC中文乱码问题 是关于ASP+MYSQL运行不稳定问题.
+-----------+----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+----------+------+-----+---------+-------+
| date | date | YES | | NULL | |
| date_time | datetime | YES | | NULL | |
+-----------+----------+------+-----+---------+-------+
2 rows in set (0.13 sec)mysql> select * from hello;
+------------+---------------------+
| date | date_time |
+------------+---------------------+
| 2004-01-07 | 2004-01-07 17:44:06 |
| NULL | 2003-11-12 00:01:00 |
+------------+---------------------+
2 rows in set (0.05 sec)mysql> alter table hello change date_time date_time date;
Query OK, 2 rows affected (0.22 sec)
Records: 2 Duplicates: 0 Warnings: 0mysql> select * from hello;
+------------+------------+
| date | date_time |
+------------+------------+
| 2004-01-07 | 2004-01-07 |
| NULL | 2003-11-12 |
+------------+------------+
2 rows in set (0.00 sec)mysql>