Bo's Oracle Station

查看: 2017|回复: 0

课程第7/8次:2016-09-09星期五,2016-09-12星期一

[复制链接]

1005

主题

1469

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
12012
发表于 2016-9-12 10:26:36 | 显示全部楼层 |阅读模式
本帖最后由 botang 于 2016-9-13 10:26 编辑

课程第7次2016-09-09星期五:
网络介绍完了。
关系型数据库基本概念和SQL五类语句介绍完了。
【1Z0-051】:共12章0 1 2 3 4 5 6 7 8 9 10 11
1Z0-052】:共19章(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
【1Z0-053】:共21章(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

共享服务器几个查询:
  1. select  * from v$circuit;

  2. select  * from v$dispatcher;

  3. select  * from v$session where saddr='00000001EC928508';
复制代码

课程第8次2016-09-12星期一:
WHERE和ORDER BY以及空值
【1Z0-051】:共12章0 1 2 3 4 5 6 7 8 9 10 11
1Z0-052】:共19章(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
【1Z0-053】:共21章(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

2016-09-12.sql:
  1. select   * from employees where employee_id=100;

  2. select  employee_id, rowid ,rownum  from employees
  3. where rownum=2;

  4. select   * from employees e where e.department_id=80;

  5. SELECT last_name||' xxxx '||first_name   "Last Name" , 12*salary*(1+nvl(commission_pct,0))  "Anaualsal"
  6. FROM   employees;

  7. select * from employees
  8. where manager_id is  null;


  9. SELECT department_name || q'# *  #'
  10.        || manager_id
  11.        AS "Department and Manager"
  12. FROM departments;

  13. SELECT DISTINCT department_id
  14. FROM   employees;

  15. select  * from employees e
  16. where e.employee_id=178;



  17. create table t05101_distinct ( a   varchar2(10)  , b varchar2(10))  ;

  18. insert into t05101_distinct  values ( 'A'   ,'B' ) ;
  19. select   distinct a, b from  t05101_distinct ;
  20.   insert into t05101_distinct  values ( 'A'   ,'B1' ) ;
  21.   
  22.    select   distinct a from  t05101_distinct ;
  23.    
  24.    
  25.    select   *
  26.      from user_tab_cols tc
  27.      where tc.TABLE_NAME='LOCATIONS';
  28.      
  29. select  * from employees
  30. where rownum=1;

  31. alter session set nls_date_format='YYYY-MM-DD';

  32. SELECT last_name
  33. FROM   employees
  34. WHERE  hire_date ='21-JUN-07';





  35. SELECT last_name
  36. FROM   employees
  37. WHERE  hire_date = to_date('21-JUN-07','DD-MON-RR') ;
  38. ---

  39. select  *
  40. from employees e
  41. where e.employee_id   not in
  42. (select manager_id from employees  
  43. where manager_id is not null);


  44. xx and yy and  zz and null

  45. create table t05102_a ( a varchar2(10)) ;

  46. insert into t05102_a  values ('A' ) ;

  47. insert into t05102_a  values ('A1' ) ;

  48. insert into t05102_a  values ('%' ) ;

  49. insert into t05102_a  values ('_' ) ;

  50. insert into t05102_a  values ('_1' ) ;


  51. select  * from   t05102_a;

  52. select  * from t05102_a where a like 'A%';
  53. select  * from t05102_a where a like 'A_';
  54. select  * from t05102_a where a like '%%';

  55. select  * from t05102_a where a like '\%%'  escape '\';
  56. select  * from t05102_a where a like '\_%'  escape '\';

  57. insert into t05102_a values ('''');

  58. select  * from t05102_a;

  59. insert into t05102_a values (chr(39)||1);

  60. ---

  61. create table t05102_b ( a  number , b number ) ;

  62. insert into t05102_b values ( 1  , 999) ;
  63. insert into t05102_b values ( 1  , 0) ;

  64. insert into t05102_b values ( 2  ,999);

  65. insert into t05102_b values (2,0);


  66. select  * from  t05102_b  
  67. order by a desc  ,b desc  ;


  68. select   employees.employee_id
  69.   from employees e ;
  70.   





  71. select   a  "X" , b  "Y" from  t05102_b
  72. order by 1  desc,2  ;


  73. select  employee_id, salary
  74.   from employees
  75.    where employee_id=&S_1;
  76.    
  77.   select  &S_1;
复制代码


回复

使用道具 举报

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

本版积分规则

QQ|手机版|Bo's Oracle Station   

GMT+8, 2024-12-5 02:49 , Processed in 0.038508 second(s), 24 queries .

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