Which two statements would execute successfully?

Examine the structure of the MARKS table:
name Null Type
STUDENT_ID NOT NULL VARCHAR2(4)
STUDENT_NAME VARCHAR2(25)
SUBJECT1 NUMBER(3)
SUBJECT2 NUMBER(3)
SUBJECT3 NUMBER(3)
Which two statements would execute successfully? (Choose two.)

Examine the structure of the MARKS table:
name Null Type
STUDENT_ID NOT NULL VARCHAR2(4)
STUDENT_NAME VARCHAR2(25)
SUBJECT1 NUMBER(3)
SUBJECT2 NUMBER(3)
SUBJECT3 NUMBER(3)
Which two statements would execute successfully? (Choose two.)

A.
SELECT student_name,subject1
FROM marks
WHERE subject1 > AVG(subject1);

B.
SELECT student_name,SUM(subject1)
FROM marks
WHERE student_name LIKE ‘R%’;

C.
SELECT SUM(subject1+subject2+subject3)
FROM marks
WHERE student_name IS NULL;

D.
SELECT SUM(DISTINCT NVL(subject1,0)), MAX(subject1)
FROM marks
WHERE subject1 > subject2;



Leave a Reply 6

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


chachu

chachu

hi ,

why is B incorrect?

sovadn

sovadn

student_name could stand next to sum only if student_name would be in group by statement

Bina

Bina

Why A is wrong?

voo

voo

because aggregate function is used in where clause

Nikita Gupta

Nikita Gupta

can anyone plz explain clearly why option b is incorrect

Ritam Tiwari

Ritam Tiwari

B is incorrect because if we are using aggregate function then we have to group by all the remaining columns that are in select statements.

so ‘group by student_name’ should be there.