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 .

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / guest

Select Stud_name
From Student_Table
Where Pass_Fail = P
Group by SI

Is This Answer Correct ?    6 Yes 19 No

Post New Answer

More DB2 Interview Questions

What else is there in the PLAN apart from the access path?

1 Answers  


How many databases are there?

0 Answers  


What is ibm db2 connect?

0 Answers  


How do you concatenate the firstname and lastname from emp table to give a complete name?

0 Answers  


What does the CHECK Utility do ?

1 Answers  






What is difference between alias and synonym in db2?

0 Answers  


If we keep the DCLGEN structure for a table in a copybook and include it in the COBOL program using the COPY statement, will there be any impact during compilation or at any stage of program execution?

2 Answers  


in db2, already 10 columns arie der, and i want to insert 11th column. what parameters u wil consider for insertion and how will u insert

1 Answers   TCS,


Name the different types of Table spaces.

5 Answers   IBM,


What is an access path?

3 Answers  


What is RUNSTATS?

3 Answers  


What is blu acceleration in db2?

0 Answers  


Categories