MySQL中的几个语句
1.计算数据表中一共有多少记录sql语句
mysql> select
count(*) from openes;
+----------+
| count(*) |
+----------+
| 136 |
+----------+
1 row in set (0.00 sec)
2.查询字段类型为datetime的SQL语句:
mysql> select * from biders where author_id =2253 and created_at
between '2009-11-10 00:00:00 ' and '2009-11-10 23:59:59';
+----+-----------+---------------------+---------------------+---------------------+
| id | author_id | created_at | updated_at | num_of_target_files |
+----+-----------+---------------------+---------------------+---------------------+
| 10 | 2353 | 2009-11-10 15:21:08 | 2009-11-10 15:21:08 | NULL |
+----+-----------+---------------------+---------------------+---------------------+
1 row in set (0.00 sec)
3.修改数据库某个字段的值:
mysql> update products set image_url='/images/1.jpg'where id=13;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0