See the Exhibit and examine the structure and data in the INVOICE table:
Exhibit:
Which two SQL statements would executes successfully? (Choose two.)
A. SELECT MAX(inv_date),MIN(cust_id) FROM invoice;
B. SELECT MAX(AVG(SYSDATE - inv_date)) FROM invoice;
C. SELECT (AVG(inv_date) FROM invoice;
D. SELECT AVG(inv_date - SYSDATE),AVG(inv_amt) FROM invoice;
Answer: A,D
Explanation:
引用官方文档:
This function takes as an argument anynumeric data type or any nonnumeric data
type that can be implicitly converted to anumeric data type. The function returns the
same data type as the numeric data type ofthe argument.
A对,
SELECT MAX (column_name) / MIN (column_name)
FROM table_name
说明:列column_name中的数据可以是数值、字符串或是日期时间数据类型。MAX()/MIN()函数将返回与被传递的列同一数据类型的单一值。
B错,选项中avg得到单一结果,无法使用max函数
C错:AVG只能应用于数值类型
D对,选项中inv_date-sysdate得到数字,所以能使用avg