Data Setup Scripts:
CREATE TABLE student (
sno NUMBER,
name VARCHAR2(30),
mark NUMBER,
result varchar2(1),
dept varchar2(5),
year number
);
BEGIN
FOR i IN 1..1000 LOOP
INSERT INTO student (sno,name,mark,dept,year)
VALUES (i,'STUDENT_'|| i,trunc(dbms_random.value(1,100)),trunc(dbms_random.value(1,6)),trunc(dbms_random.value(1,5)));
END LOOP;
COMMIT;
END;
/
update student set result='P'
where mark >=35;
update student set result='F'
where mark <35;
update student set dept='CSE' where dept='1';
update student set dept='ECE' where dept='2';
update student set dept='EEE' where dept='3';
update student set dept='MECH' where dept='4';
update student set dept='CVE' where dept='5';
commit;
SQLs to get result dashboard
select * from (
select dept,
'YEAR : '||year year,
'P = '||count(decode(result,'P','P',null)) ||', F = '||count(decode(result,'F','F',null)) R_count
from student
group by dept,year)
PIVOT ( max ( R_count)
FOR dept
IN ( 'CSE' CSE,'ECE' ECE,'MECH' MECH,'EEE' EEE,'CVE' CVE)
)
order by year;
select * from (
select dept,
year,
'P = '||count(decode(result,'P','P',null)) ||', F = '||count(decode(result,'F','F',null)) R_count
from student
group by dept,year)
PIVOT ( max ( R_count)
FOR year
IN ( 1 as I,2 II,3 III,4 IV)
);
select dept, max(case when year=1 then F_count end),
max(case when year=2 then F_count end),
max(case when year=3 then F_count end),
max(case when year=4 then F_count end)
from (
select dept,year,'P = '||count(decode(result,'P','P',null)) ||', F = '||count(decode(result,'F','F',null)) F_count
from student
group by dept,year
order by 1,2)
group by dept;
-------------------------------------------------------
create or replace function get_result_count (pin_dept varchar2, pin_year number)
return varchar2 as
lv_cnt varchar2(100);
begin
select 'P = '||count(decode(result,'P','P',null))
||', F = '||count(decode(result,'F','F',null))
into lv_cnt
from student
where dept=pin_dept
and year = pin_year;
return lv_cnt;
exception when others then
return null;
end ;
/
select dept,get_result_count(dept,1) Y_I,
get_result_count(dept,2) Y_II,
get_result_count(dept,3) Y_III,
get_result_count(dept,4) Y_IV
from(
select distinct dept
from student);
select year,get_result_count('ECE',year) ECE,
get_result_count('CSE',year) CSE ,
get_result_count('MECH',year) MECH,
get_result_count('CVE',year) CVE,
get_result_count('EEE',year) EEE
from(
select distinct year
from student);
Thanks
ReplyDeleteThis is really awesome. I liked it
ALso, I have created one new website
please check it out here is the link of My Website
Great Share. Thanks for this. I loved it.
ReplyDeleteAlso, I created one website on Sofa Reviews. So if you want to purchase some sofa, or looking for new sofas, then here is the link to my website Click Here for more information related to Sofas
you are doing good work. Please friend subscribe my blog. I will also share your posts. jo be friend mera blog subscribe krege mei uske blog ko promote kraga.
ReplyDeleteplz visit -
plz visit -
plz visit -
plz visit -
https://www.guru-nanak-ji.com
https://www.guru-nanak-ji.com
https://www.guru-nanak-ji.com
Great Share. Thanks for this. I loved it.
ReplyDeleteAlso, I created one website on Sofa Reviews. So if you want to purchase some sofa, or looking for new sofas, then here is the link to my website ClickHere for more information related to Sofas.
This article is awesome. meanwhile I have also written one article on Monitors and technology. So if you want to check it out then you can click here for more information related to Monitors
ReplyDeleteCan please upload tunning concepts
ReplyDeleteToday is the time when virtualization becomes a new paradigm of the modern computing world.
ReplyDeleteOnce you have your VMware virtual infrastructure in place, the issue of your data protection would hardly leave the scene with VM backup as its primary element. You can rely on esxi backup vm to perform consistent image-based backups of VMware VMs.
Very Informative .Please keep doing great job .
ReplyDeleteSEO Expert
ReplyDeleteYour Post Proved to be very helpful for me thank you for sharing ..
ReplyDeleteWhat are the Process of Choosing a Right Computer Institute In City of Delhi?
This is really awesome. I liked it .I will share your content with my friends.
ReplyDeletetechnology
Such a dashboard likely offers comprehensive insights into academic achievements, providing educators and administrators with vital information for monitoring student progress, identifying areas for improvement, and making data-driven decisions with the help of San Diego web design company for creating the User Robust Dashboard. With its focus on computational analysis, this dashboard promises to streamline the assessment process and enhance educational outcomes effectively.
ReplyDelete