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
define clustering index.
What is db2 purescale?
When reorg is used?
What is cobol db2?
How do I change the column size in db2?
What is the difference between db2 and oracle?
Where can you declare a cursor in a cobol-db2 program?
What is dbrm? What it contains?
How do you pull up a query which was previously saved in qmf?
What are union and union all?
can all users have the privilage to use the sql statement select * (dml)?
What is role in db2?
List down the types of triggers in the db2 database?
What is a storage group (stogroup)?
What does a deadlock mean in DB2?