Home » Oracle » 1z0-061 » Which two SQL statements would execute successfully?
View the Exhibit and examine the structure and data in the INVOICE table.
Which two SQL statements would execute successfully? (Choose two.)
A. SELECT AVG(inv_date )
FROM invoice;
B. SELECT MAX(inv_date), MIN(cust_id)
FROM invoice;
C. SELECT MAX(AVG(SYSDATE – inv_date))
FROM invoice;
D. SELECT AVG( inv_date – SYSDATE), AVG(inv_amt)
FROM invoice;
Correct Answer: BD
Explanation/Reference:
Explanation:
Using the AVG and SUM Functions
You can use the AVG, SUM, MIN, and MAX functions against the columns that can store numeric data. The example in the slide displays the average, highest, lowest, and sum of monthly salaries for all sales representatives
Using the MIN and MAX Functions
You can use the MAX and MIN functions for numeric, character, and date data types. The example in the slide displays the most junior and most senior employees.
Download Printable PDF. VALID exam to help you PASS.
|
|
A is incorrect because AVG function could not apply for DATE data type. As well as any other group function like MIN, MAX, SUM, etc
BD
C. is not correct because you cannot use nested group function without GROUP BY
Did I miss something? There doesn’t seem to be an exhibit
Exhibit not really needed. Need to look at the data types.
I don’t think their “explanation” does any real explaining though.
What figure is that you can’t use “Avg” with dates (even though dates are stored as numbers).
In “D” with “Invoice_date – SYSDATE” you get an integer and that’s why you can use AVG there.