要向date类型写记录,怎么写
insert into a(myDate)values(sysdate);
insert into a(myDate)values(to_date('2003/05/01','yyyy/mm/dd'));
-----------------
如何单独获得date字段中的年,月,日的数据
to_char(myDate,'yyyy'),to_char(myDate,'mm'),to_char(myDate,'dd')------------------
如何对一个有date字段的表进行按分别年、月、日统计
看具体情况了
insert into a(myDate)values(sysdate);
insert into a(myDate)values(to_date('2003/05/01','yyyy/mm/dd'));
-----------------
如何单独获得date字段中的年,月,日的数据
to_char(myDate,'yyyy'),to_char(myDate,'mm'),to_char(myDate,'dd')------------------
如何对一个有date字段的表进行按分别年、月、日统计
看具体情况了
id number,date1 date.insert into test(1,sysdate);
insert into test(2,to_date('06-29-2003','mm-dd-yyyy'));select to_char(date1,'yyyy') from test where id=1; --年
select to_char(date1,'mm') from test where id=1; --月
select to_char(date1,'dd') from test where id=1; --日select count(*) from test where to_char(date1,'yyyymmdd') between 20030529 and 20030629;
shop_id number
custom_id number
date1 date
sales number;
如何按月统计sales后建成另一张表
if myDate='2003/05/06'
then to_char(myDate,'yyyy')='2003/01/01'
to_char(myDate,'mm')='2003/05/01'
to_char(myDate,'dd')='2003/05/06
check
select to_char(to_date('2002-05-30','yyyy-mm-dd'),'Q') from dual;返回2