Oracle null test question

Source: Internet
Author: User

Oracle null test question

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

Comment on column TABLE1.GRZHYE is 'personal account balance ';

Comment on column TABLE1.GMSFHM is 'citizenship number ';

Comment on column TABLE1.RYLB is 'personnel category ';

Comment on column TABLE1.CARDNO is 'Card No ';

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

The data in the table is as follows:

Id, grzhye, gmsfhm, rylb, cardno

1,100,123 456770707771, 01,140 201701

2, null, 123456770707772, null, null

3,200,123 456770707773, 03,140 201703

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

A. null B. 0 C. 1 D. An error is reported.

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

A. null B. 0 C. 1 D. An error is reported.

3. select sum (grzhye) from table1; the result is ()

A. null B. 0 C. 300 D. An error is reported.

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

A. 0 B. 1 C. null D. An error is reported.

5. select avg (grzhye) from table1; the result is ()

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

6. Execute the following statement ()

Alter table TABLE1 add constraint udx_table1_cardno unique (CARDNO );

A. Successful B. Error

7. select * from table1 where cardno is null; whether the idx_table1_cardno index () is used if the optimization method is based on rules ()

A. Yes B. No

8. select * from table1 where cardno = '20160301'; how to optimize the rules and determine whether the idx_table1_cardno index () is used ()

A. Yes B. No

9. select min (grzhye) from table1; the result is ()

A. null B. 100 C. Error

10. select id | cardno from table1 where id = '2'; the result is :()

A. null B. 2 C. Error

11. Select 100 + null from dual; the result is ()

A. null B. 100 C. Error

12. Select 100 * null from dual; the result is ()

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

13. Select 100/null from dual; the result is ()

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

14. Select null/0 from dual; the result is ()

A. null B. 0 C. Error

15. select rylb, sum (grzhye)/count (rylb) from table1 group by rylb;

() Records will be found

A. 0 B. 2 C. 3 D. Error

16. select 100/sum (grzhye) from table1 where id = '2'; the result is :()

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

17. update table1 set cardno = null where id = '2 ';

Update table1 set cardno = ''where id = '2 ';

The above two sentences ,()

A. The results are the same B. Only the first sentence is successful C. Only the second sentence is successful

18. select * from table1 where cardno = ''; several records will be found ()

A. 0 B. 1 C. Error

19. select * from table1 where cardno is null; several records will be found ()

A. 0 B. 1 C. Error

20. select count (cardno) from table1; several records () will be found ()

A. 0 B. 2 C.3 D. Error

For more information about Oracle, see Oracle topics page http://www.bkjia.com/topicnews.aspx? Tid = 12

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.