在firebird 中一个时间类型用的是timestamp类型 如果让他的缺省值设置为自动获取系统当前时间current_timestamp
CREATE TABLE MYSQLS (
SYSID INTEGER default '' NOT NULL,
ENTITYID INTEGER default '' NOT NULL,
ID INTEGER default '' NOT NULL,
NAME VARCHAR(20) default '' NOT NULL,
BILLDATE TIMESTAMP default CURRENT_TIMESTAMP,
TEL VARCHAR(20) default '' NOT NULL
);
在给一个表添加一个字段
alter table orderbillscntrs add expensetime timestamp;
sql 语句distinct 的使用
select distinct id from aid;
update aid set num = 'zhang' where id = 2 (aid 表名)
select distinct * from aid;
between 和in的使用
select * from aid where id between 5 and 7; //(其中包括5和7)
select * from aid where num in('zhang','a3','a7')
其中的cast的用法
我所了解的cast 的用法就是
select cast('F' as char(1)) Selected, CarID from cars where SYSID = 1 and status = 'A';
这句查询语句的结果有两列 一列叫selected 一列叫CarID 无论有多少条数据 他的selected 列都是char(1)类型的F
简单说就是增加一列 固定类型固定值 一般用在结果集中
正佳删除字段
alter table carsadd isbilling char(1) default 'T' not null;
alter tableorderbillsplans add gavemoney double precision default 100 not null;
alter table orderbillsplans drop isbilling;
varchar(4) 可以输入4个字线,也可以输入两个汉字 nvarchar(4) 可以输四个汉字,也可以输4个字母,但最多四个 nvarchar 更适合汉字 |