SQL QUERY TO PERFORM RESULT ANALYSIS OF THE SUBJECTS GRADE WISE. Query to COUNT TOTAL NO OF AA, AB, BB, BC, CC AND FF(FAIL).
SELECT 'C_LANG' SUBJECT,
SUM(CASE WHEN C_LANG BETWEEN 85 AND 100 THEN 1 ELSE 0 END) AA,
SUM(CASE WHEN C_LANG BETWEEN 75 AND 84 THEN 1 ELSE 0 END) AB,
SUM(CASE WHEN C_LANG BETWEEN 65 AND 74 THEN 1 ELSE 0 END) BB,
SUM(CASE WHEN C_LANG BETWEEN 55 AND 64 THEN 1 ELSE 0 END) BC,
SUM(CASE WHEN C_LANG BETWEEN 50 AND 54 THEN 1 ELSE 0 END) CC,
SUM(CASE WHEN C_LANG < 50 THEN 1 ELSE 0 END) FF, COUNT(C_LANG) TOTAL
FROM STUDENT
UNION ALL
SELECT 'ORACLE' SUBJECT,
SUM(CASE WHEN ORACLE BETWEEN 85 AND 100 THEN 1 ELSE 0 END) AA,
SUM(CASE WHEN ORACLE BETWEEN 75 AND 84 THEN 1 ELSE 0 END) AB,
SUM(CASE WHEN ORACLE BETWEEN 65 AND 74 THEN 1 ELSE 0 END) BB,
SUM(CASE WHEN ORACLE BETWEEN 55 AND 64 THEN 1 ELSE 0 END) BC,
SUM(CASE WHEN ORACLE BETWEEN 50 AND 54 THEN 1 ELSE 0 END) CC,
SUM(CASE WHEN ORACLE < 50 THEN 1 ELSE 0 END) FF, COUNT(ORACLE) TOTAL
FROM STUDENT
UNION ALL
SELECT 'JAVA' SUBJECT,
SUM(CASE WHEN JAVA BETWEEN 85 AND 100 THEN 1 ELSE 0 END) AA,
SUM(CASE WHEN JAVA BETWEEN 75 AND 84 THEN 1 ELSE 0 END) AB,
SUM(CASE WHEN JAVA BETWEEN 65 AND 74 THEN 1 ELSE 0 END) BB,
SUM(CASE WHEN JAVA BETWEEN 55 AND 64 THEN 1 ELSE 0 END) BC,
SUM(CASE WHEN JAVA BETWEEN 50 AND 54 THEN 1 ELSE 0 END) CC,
SUM(CASE WHEN JAVA < 50 THEN 1 ELSE 0 END) FF, COUNT(JAVA) TOTAL
FROM STUDENT;
0 comments:
Post a Comment