Oracle null test question

Source: Internet
Author: 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 '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 class'; Comment on column table1.cardno is 'Card number'; 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 123456770707771 01 1401000001 2, null 123456770707772 null 3,200 123456770707773 03 1401000003

Each of the first two questions has 10 points, and each other has 5 points. A total of 18 questions have a full score of 100.

1. Select count (*) from Table1 where 1 = 2;

Result ()

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

2. Select sum (grzhye) from Table1 where 1 = 2;

Result ()

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

3. Select sum (grzhye) from Table1;

Result ()

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

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

Result ()

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

5. Select AVG (grzhye) from Table1;

Result ()

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

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 will be :()

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

Result :()

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

Related Article

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.