select
a.student_id
from my_table a,
my_table b
where upper(a.course)='java' and
a.student_id=b.student_id and
upper(b.course)='c'