oracle中的null测试题

前端之家收集整理的这篇文章主要介绍了oracle中的null测试题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
  1. create table TABLE1
  2. (
  3.    ID VARCHAR2(10) not null
  4.    GRZHYE NUMBER(102),   GMSFHM VARCHAR2(18),
  5.    RYLB varchar2(10),
  6.    CARDNO VARCHAR2(20)
  7. );
  8. comment on column TABLE1.ID is '个人编号';
  9. comment on column TABLE1.GRZHYE is '个人账户余额';
  10. comment on column TABLE1.GMSFHM is '公民身份号码';
  11. comment on column TABLE1.RYLB is '人员类别';
  12. comment on column TABLE1.CARDNO is '卡号';
  13.  
  14. alter table TABLE1 add constraint PK_TABLE1 primary key (ID);
  15. create index IDX_TABLE1_GMSFHM on TABLE1 (GMSFHM) tablespace YB;
  16. create index idx_table1_cardno on TABLE1 (cardno);
  17.  
  18. 表中的数据如下:
  19.   id grzhye gmsfhm rylb cardno
  20.   1 100 123456770707771 01 1401000001
  21.   2 null 123456770707772 null null
  22.   3 200 123456770707773 03 1401000003</span>
  1. 2题各10分,其它题各5分,共18题,满分100分。
  1. 1. select count(*) from table1 where 1=2;
  2.   结果为( )
  3.   A. null B. 0 C. 1 D. 会报错
  4.   2. select sum(grzhye) from table1 where 1=2;
  5.   结果为( )
  6.   A. null B. 0 C. 1 D. 会报错
  7.   3. select sumgrzhye from table1;
  8.   结果为( )
  9.   A. null B. 0 C. 300 D. 会报错
  10.   4. select count(*) from (select sum(grzhye) from table1 where 1=2);
  11.   结果为( )
  12.   A. 0 B. 1 C. null D. 会报错
  13.   5. select avg(grzhye) from table1;
  14.   结果为( )
  15.   A. 100 B. 0 C. null D. 150
  16.   6. 执行以下语句会( )
  17.   alter table TABLE1   add constraint udx_table1_cardno unique (CARDNO);
  18.   A. 成功 B. 报错
  19.   7. select * from table1 where cardno is null 如果优化方式按规则,是否会用到idx_table1_cardno索引( )   A.会 B.不会   8. select * from table1 where cardno ='123'; 如何优化方式按规则,是否会用到idx_table1_cardno索引( )
  20.   A.会 B.不会
  21.   9. select min(grzhye) from table1;
  22.   结果是( )
  23.   A. null B. 100 C. 报错
  24.   10. select id||cardno from table1 where id = '2';
  25.   结果会是:( )
  26.   A. null B. 2 C. 报错
  27.   11. Select 100 + null from dual; 结果是( )
  28.   A. null B. 100 C. 报错
  29.   12. Select 100 * null from dual; 结果是( )
  30.   A. null B. 100 C. 0 D. 报错
  31.   13. Select 100 / null from dual; 结果是( )
  32.   A. null B. 100 C. 0 D. 报错
  33.   14. Select null/0 from dual; 结果是( )
  34.   A. null B. 0 C. 报错
  35.   15. select rylbsumgrzhye)/countrylb from table1 group by rylb;
  36.   会查到( )条记录
  37.   A. 0 B. 2 C. 3 D. 报错
  38.   16. select 100/sum(grzhye) from table1 where id='2';
  39.   结果是:( )
  40.   A. null B. 0 C. 100 D. 报错
  41.   17. update table1 set cardno = null where id='2';
  42.   update table1 set cardno = '' where id='2';
  43.   以上两句,( )
  44.   A. 效果是相同的 B. 只有第一句成功 C. 只有第二句成功
  45.   18. select * from table1 where cardno='';
  46.   会查到几条记录
  47.   A. 0 B. 1 C. 报错

猜你在找的Oracle相关文章