Oracle中的null測試題 |
發(fā)布時間: 2012/7/27 17:43:40 |
create table TABLE1( ID VARCHAR2(10) not null, GRZHYE NUMBER(10,2), GMSFHM VARCHAR2(18), RYLB varchar2(10), CARDNO VARCHAR2(20)); comment on column TABLE1.ID is '個人編號'; comment on column TABLE1.GRZHYE is '個人賬戶余額'; comment on column TABLE1.GMSFHM is '公民身份號碼'; comment on column TABLE1.RYLB is '人員類別'; comment on column TABLE1.CARDNO is '卡號'; alter table TABLE1 add constraint PK_TABLE1 primary key (ID); create index IDX_TABLE1_GMSFHM on TABLE1 (GMSFHM) tablespace YB; create index idx_table1_cardno on TABLE1 (cardno); 表中的數(shù)據(jù)如下: id, grzhye, gmsfhm, rylb, cardno 1, 100, 123456770707771, 01, 1401000001 2, null, 123456770707772, null, null 3, 200, 123456770707773, 03, 1401000003 1. select count(*) from table1 where 1=2; 結(jié)果為( ) A. null B. 0 C. 1 D. 會報錯 2. select sum(grzhye) from table1 where 1=2; 結(jié)果為( ) A. null B. 0 C. 1 D. 會報錯 3. select sum(grzhye) from table1; 結(jié)果為( ) A. null B. 0 C. 300 D. 會報錯 4. select count(*) from (select sum(grzhye) from table1 where 1=2); 結(jié)果為( ) A. 0 B. 1 C. null D. 會報錯 5. select avg(grzhye) from table1; 結(jié)果為( ) A. null B. 0 C. null D. 150 E. 100 6. 執(zhí)行以下語句會 ( ) alter table TABLE1 add constraint udx_table1_cardno unique (CARDNO); A. 成功 B. 報錯 7. select * from table1 where cardno is null; 如果優(yōu)化方式按規(guī)則,是否會用到idx_table1_cardno索引( ) A.會 B.不會 8. select * from table1 where cardno =’123’; 如何優(yōu)化方式按規(guī)則,是否會用到idx_table1_cardno索引( ) A.會 B.不會 9. select min(grzhye) from table1; 結(jié)果是( ) A. null B. 100 C. 報錯 10. select id||cardno from table1 where id = ‘2’; 結(jié)果會是:( ) A. null B. 2 C. 報錯 11. Select 100 + null from dual; 結(jié)果是( ) A. null B. 100 C. 報錯 12. Select 100 * null from dual; 結(jié)果是( ) A. null B. 100 C. 0 D. 報錯 13. Select 100 / null from dual; 結(jié)果是( ) A. null B. 100 C. 0 D. 報錯 14. Select null/0 from dual; 結(jié)果是( ) A. null B. 0 C. 報錯 15. select rylb,sum(grzhye)/count(rylb) from table1 group by rylb; 會查到( )條記錄 A. 0條 B. 2條 C. 3條 D. 報錯 16. select 100/sum(grzhye) from table1 where id='2'; 結(jié)果是: ( ) A. null B. 0 C. 100 D. 報錯 17. update table1 set cardno = null where id='2'; update table1 set cardno = ‘’ where id='2'; 以上兩句,( ) A. 效果是相同的 B. 只有第一句成功 C. 只有第二句成功 18. select * from table1 where cardno=''; 會查到幾條記錄 ( ) A. 0 B. 1 C. 報錯 19. select * from table1 where cardno is null; 會查到幾條記錄 ( ) A. 0 B. 1 C. 報錯 20. select count(cardno) from table1; 會查到幾條記錄 ( ) A. 0 B. 2 C.3 D. 報錯 本文出自:億恩科技【mszdt.com】 服務(wù)器租用/服務(wù)器托管中國五強(qiáng)!虛擬主機(jī)域名注冊頂級提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM] |