Advertisement
ma39isy

Query Portfolio Matakuliah

Dec 14th, 2023
1,389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.     DISTINCT
  3.                         SUBJECTID,
  4.     CLOMAPPINGID,
  5.     SCOREMINIMUM,
  6.     CLOCLOID,
  7.     CLONAME,
  8.     CONCAT( 'CLO-', LPAD( CLONUMBER, 2, '0' ) ) AS CLONUMBER,
  9.     CLOPLOID,
  10.     CONCAT( 'PLO-', LPAD( PLONUMBER, 2, '0' ) ) AS PLONUMBER,
  11.     CLOASSESSMENTTOOLSNAME AS ASSESSMENTTOOL,
  12.     ROUND( AVG(NILAI_CLO), 2 ) AS RATARATA_CLO,
  13.     SUM( CASE WHEN NILAI_CLO > 50.01 THEN 1 ELSE 0 END ) AS DIATAS,
  14.     SUM( CASE WHEN NILAI_CLO = 50.01 THEN 1 ELSE 0 END ) AS SESUAI,
  15.     SUM( CASE WHEN NILAI_CLO < 50.01 THEN 1 ELSE 0 END ) AS DIBAWAH,
  16.     ROUND( SUM( CASE WHEN NILAI_CLO >= 50.01 THEN 1 ELSE 0 END ) / COUNT(NILAI_CLO) * 100, 2 ) AS REALISASI,
  17.     ROUND( ( SUM( CASE WHEN NILAI_CLO >= 50.01 THEN 1 ELSE 0 END ) / COUNT(NILAI_CLO) * 100 ) - 85, 2 ) AS GAP_PENINGKATAN,
  18.     EVALUATION,
  19.     IMPROVMENT AS IMPROVEMENT,
  20.     CASE
  21.         WHEN ROUND( AVG(NILAI_CLO), 2 ) >= 50.01 THEN
  22.                             'TERCAPAI'
  23.         ELSE 'TIDAK TERCAPAI'
  24.     END AS STATUS_KETERCAPAIAN
  25. FROM
  26.     (
  27.     SELECT
  28.         A.STUDYPROGRAMID,
  29.         A.STUDYPROGRAMNAME,
  30.         A.SUBJECTID,
  31.         A.SUBJECTCODE,
  32.         A.SUBJECTNAME,
  33.         A.CLOPLOID,
  34.         A.SCOREMINIMUM,
  35.         A.PLONUMBER,
  36.         A.CLOCLOID,
  37.         A.CLONAME,
  38.         A.CLONUMBER,
  39.         A.COURSEID,
  40.         A.CLASS,
  41.         A.STUDENTID,
  42.         A.SCHOOLYEAR,
  43.         A.SEMESTER,
  44.         A.CLOMAPPINGID,
  45.         A.PERCENTAGE_CLO,
  46.         A.EVALUATION,
  47.         A.IMPROVMENT,
  48.         (
  49.         SELECT
  50.             REGEXP_REPLACE( ( listagg ( E.CLOASSESSMENTTOOLSNAME, ',' ) WITHIN GROUP ( ORDER BY E.CLOASSESSMENTTOOLSNAME ) ), '([^,]*)(, )+($|,)', ' ' )
  51.         FROM
  52.             (
  53.             SELECT
  54.                 DISTINCT
  55.                                     SUBJECTCODE,
  56.                 STUDYPROGRAMID,
  57.                 SCHOOLYEAR,
  58.                 SEMESTER,
  59.                 CLOASSESSMENTTOOLSNAME,
  60.                 CLOASSESSMENTTOOLSID,
  61.                 CLOMAPPINGID
  62.             FROM
  63.                 CLOASSESSMENTTOOLS
  64.             JOIN CLOQUESTION Q ON
  65.                 ( CLOASSESSMENTTOOLSID = Q.CLOASSESMENTID )
  66.                                 ) E
  67.         WHERE
  68.             SUBJECTCODE = A.SUBJECTCODE
  69.             AND STUDYPROGRAMID = A.STUDYPROGRAMID
  70.             AND SCHOOLYEAR = A.SCHOOLYEAR
  71.             AND SEMESTER = A.SEMESTER
  72.             AND CLOMAPPINGID = A.CLOMAPPINGID
  73.                             ) AS CLOASSESSMENTTOOLSNAME,
  74.         ROUND( SUM(NILAIPERQUEST) / PERCENTAGE_CLO, 2 ) * 100 AS NILAI_CLO
  75.     FROM
  76.         (
  77.         SELECT
  78.             B.STUDYPROGRAMID,
  79.             B.STUDYPROGRAMNAME,
  80.             D.SUBJECTCODE,
  81.             H.SUBJECTID,
  82.             H.SUBJECTNAME,
  83.             A.CLOPLOID,
  84.             A.SCOREMINIMUM,
  85.             A.PLONUMBER,
  86.             A.PLONAME,
  87.             C.CLOCLOID,
  88.             C.CLONUMBER,
  89.             C.CLONAME,
  90.             D.SCHOOLYEAR,
  91.             D.SEMESTER,
  92.             CSP.COURSEID,
  93.             COURSE.CLASS,
  94.             CQ.QUESTIONDESCRIPTION,
  95.             CQ.PERCENTAGE,
  96.             D.CLOMAPPINGID,
  97.             CQ.CLOASSESMENTID,
  98.             CSP.STUDENTID,
  99.             CE.EVALUATION,
  100.             CE.IMPROVMENT,
  101.             SUM(CQ.PERCENTAGE) OVER ( PARTITION BY C.CLOPLOID,
  102.             H.SUBJECTID,
  103.             CSP.STUDENTID ) AS PERCENTAGE_PLO,
  104.             SUM(CQ.PERCENTAGE) OVER ( PARTITION BY C.CLOCLOID,
  105.             H.SUBJECTID,
  106.             CSP.STUDENTID ) AS PERCENTAGE_CLO,
  107.             NVL( CSP.CLOPOINT, 0 ) * ( CQ.PERCENTAGE / 100 ) AS NILAIPERQUEST
  108.         FROM
  109.             ACADEMIC.CLOPLO A
  110.         LEFT JOIN MASTERDATA.STUDYPROGRAM B ON
  111.             ( A.STUDYPROGRAMID = B.STUDYPROGRAMID )
  112.         LEFT JOIN ACADEMIC.CLOCLO C ON
  113.             ( A.CLOPLOID = C.CLOPLOID )
  114.         LEFT JOIN ACADEMIC.CLOMAPPING D ON
  115.             ( C.CLOCLOID = D.CLOCLOID
  116.                 AND D.ACTIVESTATUS = 'Y' )
  117.         LEFT JOIN ACADEMIC.SUBJECTS H ON
  118.             ( D.SUBJECTCODE = H.SUBJECTCODE
  119.                 AND A.STUDYPROGRAMID = H.STUDYPROGRAMID
  120.                 AND H.ACTIVESTATUS = 'YA' )
  121.         LEFT JOIN ACADEMIC.CLOQUESTION CQ ON
  122.             ( D.CLOMAPPINGID = CQ.CLOMAPPINGID )
  123.         LEFT JOIN ACADEMIC.CLOSTUDENTPOINT CSP ON
  124.             ( CQ.CLOQUESTIONID = CSP.CLOQUESTIONID )
  125.         LEFT JOIN ACADEMIC.COURSE ON
  126.             ( CSP.COURSEID = COURSE.COURSEID )
  127.         LEFT JOIN ACADEMIC.CLO_SUBJECTS_EVALUATION CE ON
  128.             ( COURSE.SUBJECTID = CE.SUBJECTID
  129.                 AND D.CLOMAPPINGID = CE.CLOMAPPINGID
  130.                 AND CE.SCHOOLYEAR = COURSE.SCHOOLYEAR
  131.                 AND CE.SEMESTER = COURSE.SEMESTER)
  132.         JOIN (
  133.             SELECT
  134.                 AAA.COURSEID,
  135.                 AAA.STUDENTID
  136.             FROM
  137.                 STUDENTSTUDYCARD AAA
  138.             JOIN COURSE BBB ON
  139.                 ( AAA.COURSEID = BBB.COURSEID )
  140.             WHERE
  141.                 BBB.SCHOOLYEAR = 2223
  142.                 AND BBB.SEMESTER = 1
  143.                 AND BBB.SUBJECTID = 25814
  144.                 AND AAA.STATUS = 'BERLAKU'
  145.                                     ) STC ON
  146.             ( CSP.COURSEID = STC.COURSEID
  147.                 AND STC.STUDENTID = CSP.STUDENTID )
  148.         WHERE
  149.             ACADEMIC.COURSE.SUBJECTID = 25814
  150.             AND ACADEMIC.COURSE.SCHOOLYEAR = 2223
  151.             AND ACADEMIC.COURSE.SEMESTER = 1
  152.                             ) A
  153.     WHERE
  154.         STUDYPROGRAMID = '31'
  155.     GROUP BY
  156.         A.STUDYPROGRAMID,
  157.         A.STUDYPROGRAMNAME,
  158.         A.SUBJECTID,
  159.         A.SUBJECTCODE,
  160.         A.SUBJECTNAME,
  161.         A.CLOPLOID,
  162.         A.SCOREMINIMUM,
  163.         A.PLONUMBER,
  164.         A.CLOCLOID,
  165.         A.CLONAME,
  166.         A.CLONUMBER,
  167.         A.COURSEID,
  168.         A.CLASS,
  169.         A.STUDENTID,
  170.         A.SCHOOLYEAR,
  171.         A.SEMESTER,
  172.         A.CLOMAPPINGID,
  173.         A.PERCENTAGE_CLO,
  174.         A.EVALUATION,
  175.         A.IMPROVMENT
  176.                         )
  177. GROUP BY
  178.     SUBJECTID,
  179.     CLOMAPPINGID,
  180.     SCOREMINIMUM,
  181.     CLOCLOID,
  182.     CLONAME,
  183.     CLONUMBER,
  184.     CLOPLOID,
  185.     PLONUMBER,
  186.     CLOASSESSMENTTOOLSNAME,
  187.     EVALUATION,
  188.     IMPROVMENT
  189. ORDER BY
  190.     CLONUMBER,
  191.     PLONUMBER ASC;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement