SI Stud name Subject Marks Pass/Fail
1 Sham Maths 40 P
1 Sham Physics 50 P
1 Sham Bio 20 F
2 Ram Maths 40 P
2 Ram Physics 50 P
2 Ram Bio 60 P

For the above data , write the SQL query for the student who passed in all the subjects . For eg : I want the data of only Ram coz he passed all subjects .

Answer Posted / ajmal

SELECT *
FROM STUDENT_TABLE
WHERE SI NOT IN
(SELECT DISTINCT SI
FROM STUDENT_TABLE
WHERE PASS_FAIL = 'F'
)


The inner query will retrieve all the SI numbers for who is failed in at least 1 subject(eg: Sham). The outer query will retrieve the other student's details(eg: Ram).

Is This Answer Correct ?    19 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can the firstname and the lastname from the emp table be concatenated to generate complete names?

744


When do you specify the isolation level?

606


What is the physical storage length of date data type?

724


What is the result of open cursor statement?

636


What is db2 connect?

603






What is the use of value function?

622


Comment whether dclgen is mandatorily used. If not, then what is the point of using it?

606


What is coalesce in db2?

680


List out the three types of page locks that can be held.

685


List down the types of triggers in the db2 database?

588


Which are the db2 tools to protect integrity of the database?

688


Are views updateable?

642


Explain dclgen.

722


Explain what are the various isolation levels possible?

608


While unloading huge amount of data from table. Suddenly job failed some error. Imagine 1M data unloading, In that 90% data unloaded only 10% left, So if want to unload the rest 10% what needs to be done? Whether do i need to start from top or anything ?

1818