首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

现有一张表,速求能够帮小弟我做一条oracle语句

2012-04-12 
现有一张表,速求能够帮我做一条oracle语句?create table sell(id int not null primary key ,name varchar

现有一张表,速求能够帮我做一条oracle语句?
create table sell(

  id int not null primary key ,
 
  name varchar(100) not null,
 
  dt date not null,
 
  price decimal (10,2) not null
);




insert into sell(id, name, dt, price)
select 1, '香烟' ,to_date('2012-01-01 12:03:00','yyyy-MM-dd HH24:mi:ss'),12.00 from dual
union 

select 2, '衣服' ,to_date('2012-03-01 12:03:00','yyyy-MM-dd HH24:mi:ss'),240.00 from dual
union 
select 3, '手机' ,to_date('2012-04-01 12:03:00','yyyy-MM-dd HH24:mi:ss'),1200.00 from dual
union 

select 4, '可乐' ,to_date('2012-08-01 12:03:00','yyyy-MM-dd HH24:mi:ss'),5.00 from dual
union 
select 5, '啤酒' ,to_date('2012-01-01 12:03:00','yyyy-MM-dd HH24:mi:ss'),10.00 from dual


/*表一
季度 消费金额
*/
  **** ****
  **** ****





/*表二
1季度 2季度 3季度 4季度
*/  
  **** **** **** ****
  **** **** **** ****

[解决办法]
测试数据:

SQL code
create table sell(    id int not null primary KEY,      name varchar(100) not null,      dt date not null,      price decimal (10,2) not null);insert into sell(id, name, dt, price)select 1, '香烟' ,to_date('2012-01-01 12:03:00','yyyy-MM-dd HH24:mi:ss'),12.00 from dualunion  select 2, '衣服' ,to_date('2012-03-01 12:03:00','yyyy-MM-dd HH24:mi:ss'),240.00 from dualunion  select 3, '手机' ,to_date('2012-04-01 12:03:00','yyyy-MM-dd HH24:mi:ss'),1200.00 from dualunion  select 4, '可乐' ,to_date('2012-08-01 12:03:00','yyyy-MM-dd HH24:mi:ss'),5.00 from dualunion  select 5, '啤酒' ,to_date('2012-01-01 12:03:00','yyyy-MM-dd HH24:mi:ss'),10.00 from dualSELECT * FROM sell; 

热点排行