1.请教,Oracle中的语句写法~~~
create table wcy_t1(ID number,InputTime date);insert into wcy_t1 values(1 ,to_date('2011-04-18 00:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(2 ,to_date('2011-04-18 01:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(3 ,to_date('2011-04-18 02:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(4 ,to_date('2011-04-18 03:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(5 ,to_date('2011-04-18 04:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(6 ,to_date('2011-04-18 05:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(7 ,to_date('2011-04-18 06:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(8 ,to_date('2011-04-18 08:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(9 ,to_date('2011-04-18 10:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(10 ,to_date('2011-04-18 11:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(11 ,to_date('2011-04-18 12:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(12 ,to_date('2011-04-18 14:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(13 ,to_date('2011-04-18 15:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(14 ,to_date('2011-04-18 16:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(15 ,to_date('2011-04-18 17:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(16 ,to_date('2011-04-18 18:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(17 ,to_date('2011-04-18 19:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(18 ,to_date('2011-04-18 20:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(19 ,to_date('2011-04-18 21:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(20 ,to_date('2011-04-18 22:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(21 ,to_date('2011-04-18 23:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(22 ,to_date('2011-04-19 00:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(23 ,to_date('2011-04-19 01:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(24 ,to_date('2011-04-19 02:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(25 ,to_date('2011-04-19 05:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(26 ,to_date('2011-04-19 06:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(27 ,to_date('2011-04-19 07:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(28 ,to_date('2011-04-19 08:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(29 ,to_date('2011-04-19 10:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(30 ,to_date('2011-04-19 11:00:00','yyyy-mm-dd hh24:mi:ss'));create or replace view v$test as select inputtime start_time,( select min(inputtime) from wcy_t1 f2 where not exists ( select 1 from wcy_t1 f3 where trunc(f3.inputtime,'hh24')=trunc(f2.inputtime,'hh24')+1/24) and f2.inputtime>=f1.inputtime) end_time from wcy_t1 f1;select * from v$test;select to_char(min(start_time),'yyyy-mm-dd hh24:mi:ss')||' 至 '||to_char(end_time,'yyyy-mm-dd hh24:mi:ss') from v$test group by end_time order by end_time;。
2.关于oracle中的sql语句的写法
1. select a.no from A a inner join (select * from B unin select * from C) b on a.no=b.no where a.name!=b.name
2. select no from A a where no not in(select no from B unin select no from C) unin select no from (select no from B unin select no from C) where no not in (select no from A)
3.oracle中判断语句怎么写
是存储过程里面的 IF/ELSE ? 还是简单的 DECODE ?
SQL> DECLARE
2 testvalue INT;
3 BEGIN
4 testvalue := 100;
5
6 IF testvalue > 100 THEN
7 dbms_output.put_line( '100+' );
8 ELSIF testvalue = 100 THEN
9 dbms_output.put_line( '100' );
10 ELSE
11 dbms_output.put_line( '100-' );
12 END IF;
13
14 END;
15 /
100
PL/SQL procedure successfully completed.
SQL> SELECT
2 DECODE(GROUPING(sale_item), 1, 'ALL', sale_item) AS iten,
3 SUM(sale_money) AS money
4 FROM
5 sale_report
6 GROUP BY
7 ROLLUP(sale_item);
ITEN MONEY
------ ----------
A 733285
B 2382
C 5738
ALL 741405
4.oracle怎么写IF语句
如果是 SQL 语句里面使用。
使用 DECODE 或者 CASE WHEN
DECODE 的用法就是
DECODE(abc, 50, 'A', 'B')
CASE WHEN 的用法就是
CASE WHEN abc=50 THEN 'A' ELSE 'B' END
如果是在存储过程里面的话,就是简单的 IF/ELSE 了
SQL 语句的话,就是
SELECT
abc, DECODE(abc, 50, 'A', 'B')
FROM
表
5.oracle sql 语句修改表中数据怎么写
修改:update cmsuser set name=aaaa where id=1;添加:insert into cmsuser values(。);--需自己添加删除:delete from cmsuser where id=1。
1. 甲骨文股份有限公司(Oracle)是全球大型数据库软件公司,总部位于美国加州红木城的红木岸。在2008年,甲骨文股份有限公司是继Microsoft及IBM后,全球收入第三多的软件公司。
2. Oracle数据库产品为财富排行榜上的前1000家公司所采用,许多大型网站也选用了Oracle系统。甲骨文股份有限公司于1989年正式进入中国,在北京、上海、广州和成都均设立了分支机构。
3. 2013年7月15日起甲骨文公司正式由纳斯达克转板至纽约证券交易所挂牌上市。转板至纽交所后,甲骨文公司将沿用“ORCL”这一交易代码。
4. 2013年,甲骨文已超越IBM,成为继Microsoft后全球第二大软件公司。
5. 2015年12月,甲骨文宣布收购云计算创业公司StackEngine。
6. 2017年7月19日,甲骨文称会在欧洲、中东和非洲(EMEA地区)再招聘1000个员工帮助大力推广它的云计算服务。
转载请注明出处育才学习网 » oracle中怎么写语句