nerdexam
Oracle

1Z0-007 · Question #155

Examine the description of the MARKS table: SUBJ1 and SUBJ2 indicate the marks obtained by a student in two subjects. Examine this SELECT statement based on the MARKS table: SELECT subj1+subj2…

The correct answer is C. The statement returns an error at the WHERE clause. The statement returns an error at the WHERE clause because group function AVG() cannot be used in the WHERE clause. Group functions can be used in SELECT clause and GROUP BY clause. They allow you to perform data operations on several values in a column of data as though the…

Using Functions (Single-Row, Group, Conversion, Conditional)

Question

Examine the description of the MARKS table:

SUBJ1 and SUBJ2 indicate the marks obtained by a student in two subjects. Examine this SELECT statement based on the MARKS table:

SELECT subj1+subj2 total_marks, std_id FROM marks WHERE subj1 > AVG (subj1) AND subj2 > AVG(subj2) ORDER BY total_marks; What is the result of the SELECT statement?

Options

  • AThe statement executes successfully and returns the student ID and sum of all marks for each student
  • BThe statement returns an error at the SELECT clause.
  • CThe statement returns an error at the WHERE clause.
  • DThe statement returns an error at the ORDER BY clause.

How the community answered

(34 responses)
  • A
    6% (2)
  • B
    9% (3)
  • C
    82% (28)
  • D
    3% (1)

Explanation

The statement returns an error at the WHERE clause because group function AVG() cannot be used in the WHERE clause. Group functions can be used in SELECT clause and GROUP BY clause. They allow you to perform data operations on several values in a column of data as though the column were one collective group of data. Incorrect Answers A: The statement does not execute successfully because an error will be generated. B: The statement returns an error at the WHERE, not at the SELECT clause. D: The statement returns an error at the WHERE, not at the ORDER BY clause.

Topics

#group functions in WHERE#AVG function#HAVING clause#aggregate restriction

Community Discussion

No community discussion yet for this question.

Full 1Z0-007 Practice