Bo's Oracle Station

查看: 1854|回复: 0

第39次:2015-08-13 星期四

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2015-8-14 09:31:43 | 显示全部楼层 |阅读模式
2015-08-13a.sql
  1. select  'a'||'b'||'c'  from dual;

  2. select concat(concat( 'a','b'),'c')  from dual;

  3. select  substr('Hello World',2 )  from dual;

  4. select  substr('Hello World',2,1 )  from dual;

  5. select  substr('Hello World',-2,1 )  from dual;

  6. select  length('Hello World')  from dual;

  7. select  lengthb('Hello World')  from dual;

  8. select  instr('Hello World','a')  from dual;

  9. select lpad('a',2,'*')  from dual;

  10. select  trim('e' from   'Hello World')  from dual;

  11. select  replace ('Hello World','o') from dual;

  12. select  replace(substr('Hello World',1,5),'o')||' '||substr('Hello World',7)   from dual;

  13. select sysdate from dual;
复制代码
2015-08-13b.sql

  1. SELECT  department_id, AVG(salary)
  2. FROM     employees
  3. where department_id>80
  4. GROUP BY department_id
  5. having  AVG(salary) >8000  
  6. ;


  7. select  employee_id ,salary  from employees e
  8. where salary > ( SELECT  AVG(salary)
  9.   FROM     employees a
  10. where   a.department_id=e.department_id
  11. GROUP BY  a.department_id );


  12. select e.employee_id , e.salary , e.department_id from
  13. (SELECT  department_id, AVG(salary)  avgsal
  14. FROM     employees
  15. GROUP BY department_id
  16.   )  a ,  employees e
  17. where a.department_id=e.department_id
  18. and e.salary > a.avgsal
  19. ;



复制代码






上完1Z0-051第3章        (52-27)

上完1Z0-051第4章        (52-28)
上完1Z0-051第5章        (52-29)



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-3-29 17:03 , Processed in 0.104072 second(s), 24 queries .

快速回复 返回顶部 返回列表