oracle中的null測試題

來源:互聯網
上載者:User

   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);  表中的資料如下:  id   grzhye   gmsfhm             rylb        cardno  1,   100     123456770707771    01          1401000001  2,   null    123456770707772    null        null  3,   200     123456770707773    03          1401000003

  前2題各10分,其它題各5分,共18題,滿分100分。

  1. select count(*) from table1 where 1=2;

  結果為(      )

  A.  null          B. 0          C.  1     D. 會報錯

  2.  select sum(grzhye) from table1 where 1=2;

  結果為(      )

  A.  null          B.  0        C.  1     D. 會報錯

  3.  select sum(grzhye)  from table1;

  結果為(      )

  A.  null         B.  0        C. 300       D. 會報錯

  4.  select count(*) from (select sum(grzhye) from table1 where 1=2);

  結果為(      )

  A.  0         B.  1        C. null       D. 會報錯

  5.  select  avg(grzhye) from table1;

  結果為(      )

  A.  100         B.  0        C. null       D. 150

  6. 執行以下語句會(      )

  alter table TABLE1

  add constraint udx_table1_cardno unique (CARDNO);

  A. 成功   B. 報錯

  7. select * from table1 where cardno is null; 如果最佳化方式按規則,是否會用到idx_table1_cardno索引(      )

  A.會   B.不會

  8. select * from table1 where cardno ='123'; 如何最佳化方式按規則,是否會用到idx_table1_cardno索引(      )

  A.會   B.不會

  9. select min(grzhye)  from table1;

  結果是(      )

  A. null     B. 100   C.  報錯

  10. select id||cardno from table1 where id = '2';

  結果會是:(      )

  A. null    B. 2     C. 報錯

  11. Select 100 + null from dual;      結果是(      )

  A. null   B. 100    C. 報錯

  12. Select 100 * null from dual;      結果是(      )

  A. null   B. 100    C. 0        D. 報錯

  13. Select 100 / null from dual;      結果是(      )

  A. null   B. 100    C. 0        D. 報錯

  14. Select  null/0 from dual;      結果是(      )

  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';

  結果是:(      )

  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. 報錯

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.