MySQL中用sql语句插入时期
mysql> create table testdate(
-> id int not null auto_increment primary key,
-> time date);
Query OK, 0 rows affected (0.30 sec)
mysql> insert into testdate(time) values('2010-4-23');
Query OK, 1 row affected (0.06 sec)
mysql> select * from testdate;
+----+------------+
| id | time |
+----+------------+
| 1 | 2010-4-23|
+----+------------+
1 row in set (0.00 sec)
mysql> alter table testdate add column current time;
Query OK, 1 row affected (0.25 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> update testdate set current='21:18:00' where id=1;
Query OK, 1 row affected (0.06 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from testdate;
+----+------------+----------+
| id | time | current |
+----+------------+----------+
| 1 | 2010-4-23 | 21:18:00 |
+----+------------+----------+
1 row in set (0.00 sec)
mysql> alter table testdate add column combine timestamp;
Query OK, 1 row affected (0.14 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> update testdate set combine='20050504212000' where id=1;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0
mysql> select * from testdate;
+----+------------+----------+---------------------+
| id | time | current | combine |
+----+-------
相关文档:
“Where” 是一个约束声明,使用Where来约束来之数据库的数据,Where是在结果返回之前起作用的,且Where中不能使用聚合函数。
“Having”是一个过滤声明,是在查询返回结果集以后对查询结果进行的过滤操作,在Having中可以使用聚合函数。
在说区别之前,得先介绍GROUP BY这个子句,而在说GROUP子句前 ......
由于前段时间要用powerdesigner设计数据库,可数据库设计好后好导入MysQL时需要ODBC连接,而MysQL5.0以上的均要修改密码(我在网上查过),按他们的意思修改了root密码,结果是直接进不了MysQL了,我那个郁闷,在网上查找资料,也按他们的方法做了,可还是不行(本人对dos不熟)。但最终还是可以了,下面说下具体方法
1、w ......
在FC8中默认安装的有mysql,没有的话可以很方便的安装下。
默认的mysql的include文件目录在/usr/include/mysql
默认的mysql的lib文件夹在/usr/lib/mysql
这两个目录在我们编译时候需要到。
我的测试用的C代码为:
#include <stdio.h>
#include <stdlib.h>
#include <mysql.h>
#define CONN_HOST ......
Sql Server 中一个非常强大的日期格式化函数
--
Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM
Select CONVERT(varchar(100), GETDATE(), 1): 05/16/06
Select CONVERT(varchar(100), GETDATE(), 2): 06.05.16
Select CONVERT(varchar(100), GETDATE(), 3): 16/05/06
Select CONVERT(varchar(10 ......
以下是第一篇:
/*--比较两个数据库的表结构差异
--*/
/*--调用示例
exec p_comparestructure 'xzkh_model','xzkh_new'
--*/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[p_comparestructure]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[p_comparestructure ......