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
How can we read records for specific member in CL? AND rpg?
what is the role of the cursor in db2?
What r the comman abends in db2, jcl and cobol???????
What are db2 objects?
Explain dclgen.
How can you do the explain of a dynamic sql statement?
Hi, i would like to start a new carrier in DB2 DBA.Which and what all step should i have to take..?
Explain various types of locks in db2?
what is utility for parm lib
What is cascading rollback?
What is the maximum length of sqlca?
What is declare cursor?
How do you pull up a query which was previously saved in qmf?
How to resolve deadlock issue
Explain in brief how does db2 determine what lock-size to use?