一、原题
二、题目翻译
三、题目解析
Which two statements are true regarding the COUNT function? (Choose two.)
A. The COUNT function can be used only for CHAR, VARCHAR2, and NUMBER data types.
B. COUNT(*) returns the number of rows including duplicate rows and rows containing NULL value in any of the columns.
C. COUNT(cust_id) returns the number of rows including rows with duplicate customer IDs and NULL value in the CUST_ID column.
D. COUNT(DISTINCT inv_amt)returns the number of rows excluding rows containing duplicates and NULL values in the INV_AMT column.
E. A SELECT statement using the COUNT function with a DISTINCT keyword cannot have a WHERE clause.
答案:BD
A. The COUNT function can be used only for CHAR, VARCHAR2, and NUMBER data types.
B. COUNT(*) returns the number of rows including duplicate rows and rows containing NULL value in any of the columns.
C. COUNT(cust_id) returns the number of rows including rows with duplicate customer IDs and NULL value in the CUST_ID column.
D. COUNT(DISTINCT inv_amt)returns the number of rows excluding rows containing duplicates and NULL values in the INV_AMT column.
E. A SELECT statement using the COUNT function with a DISTINCT keyword cannot have a WHERE clause.
答案:BD
二、题目翻译
关于COUNT函数的描述,哪两个句子是正确的?(选择两个)
A.COUNT函数只能用于CHAR,VARCHAR2,NUMBER数据类型。
B.count(*)返回包括重复行和NULL的行。
C.COUNT(cust_id)返回包括重复行和NULL的行。
D.COUNT(DISTINCT inv_amt)返回不包括重复值和NULL的行。
E.使用带有DISTINCT关键字的COUNT函数的SELECT语句不能含有WHERE子句。
A.COUNT函数只能用于CHAR,VARCHAR2,NUMBER数据类型。
B.count(*)返回包括重复行和NULL的行。
C.COUNT(cust_id)返回包括重复行和NULL的行。
D.COUNT(DISTINCT inv_amt)返回不包括重复值和NULL的行。
E.使用带有DISTINCT关键字的COUNT函数的SELECT语句不能含有WHERE子句。
三、题目解析
A选项不正确,因为还可以为DATE型。
B选项正确,count(*)是所有的行,重复行和有null值的行也包括。
C选项不正确,同B选项,因为不包括NULL行。
D选项正确,COUNT本身就不包括null值的行,distinct已经先将重复行去掉了。
E选项不正确,DISTINCT是去重,可以用where过滤完之后再去重。
B选项正确,count(*)是所有的行,重复行和有null值的行也包括。
C选项不正确,同B选项,因为不包括NULL行。
D选项正确,COUNT本身就不包括null值的行,distinct已经先将重复行去掉了。
E选项不正确,DISTINCT是去重,可以用where过滤完之后再去重。