Try this
select
rollno, name, subject,
english_score, french_score, german_source, spanish_score
from
(select
RollNo, name, subject,
decode(subject, "English", score, "") English_score,
decode(subject, "French", score, "") French_score,
decode(subject, "Germany", score, "") German_score,
decode(subject, "Spanish", score, "") Spanish_score,
count(*)
from
tbl
group by
RollNo, name, subject,
decode(subject, "English", score, "") English_score,
decode(subject, "French", score, "") French_score,
decode(subject, "Germany", score, "") German_score,
decode(subject, "Spanish", score, "") Spanish_score)) tbl2
There is an option in Oracle to not display a column. I think it's "noprint" I just don't remember the syntax. You'd put it next to the count(*)
:
Select
RollNo, name, subject,
decode(subject, "English", score, "") English_score,
decode(subject, "French", score, "") French_score,
decode(subject, "Germany", score, "") German_score,
decode(subject, "Spanish", score, "") Spanish_score,
count(*) noprint
from
tbl
group by
RollNo, name, subject,
decode(subject, "English", score, "") English_score,
decode(subject, "French", score, "") French_score,
decode(subject, "Germany", score, "") German_score,
decode(subject, "Spanish", score, "") Spanish_score