What is the result of the SELECT statement?

Examine the description of the MARKS table:
STD_ID NUMBER(4)
STUDENT_NAME VARCHAR2(30)
SUBJ1 NUMBER(3)
SUBJ2 NUMBER(3)
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?

Examine the description of the MARKS table:
STD_ID NUMBER(4)
STUDENT_NAME VARCHAR2(30)
SUBJ1 NUMBER(3)
SUBJ2 NUMBER(3)
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?

A.
The statement returns an error at the WHERE clause.

B.
The statement returns an error at the SELECT clause.

C.
The statement returns an error at the ORDER BY clause.

D.
The statement executes successfully and returns the student ID and sum of all marks for each
student who obtained more than the average mark in each subject.

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.



Leave a Reply 0

Your email address will not be published. Required fields are marked *