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
Explain what are the various isolation levels possible?
Explain about dbrm.
can any one provide me the link for the db2 v7 & db2 v8 manual for Z/os? i need to know about the syntax of REORG in both versions & need to know the difference as well
How does cobol compile db2 program?
What is dclgen (declaration generator)?
How can you do the explain of a dynamic sql statement?
How to find the maximum value in a column in the db2 database?
What is the maximum size of varchar data type in db2?
How can you classify the locks in db2?
How to take backup of table in db2?
What is a system catalog table in db2?
Mention data types used in db2 ?
Explain about cursor stability?
What type of database is db2?
List out the data types available.