| | 1 | = Advanced Reports = |
| | 2 | |
| | 3 | == Report 1: Academic Resource Distribution == |
| | 4 | |
| | 5 | === Data requirements idea/concept title === |
| | 6 | |
| | 7 | '''Faculty and Staffing Overview by University''' |
| | 8 | |
| | 9 | === Data requirements description === |
| | 10 | |
| | 11 | This report summarizes how many professors and subjects are assigned to each faculty within every university. It uses existing relationships between the university, faculty, professor, and subject tables to provide a "snapshot" of the university's size. |
| | 12 | |
| | 13 | === Solution SQL === |
| | 14 | |
| | 15 | {{{ |
| | 16 | #!sql |
| | 17 | SELECT u.name AS university_name, f.name AS faculty_name, COUNT(DISTINCT p.id) AS total_professors, COUNT(DISTINCT s.id) AS total_subjects |
| | 18 | FROM university u JOIN faculty f ON u.id = f.universityid LEFT JOIN professor p ON f.id = p.facultyid LEFT JOIN subject s ON f.id = s.facultyid |
| | 19 | GROUP BY u.name, f.name |
| | 20 | ORDER BY total_professors DESC; |
| | 21 | }}} |
| | 22 | |
| | 23 | === Solution Relational Algebra === |
| | 24 | |
| | 25 | {{{ |
| | 26 | gamma_{u.name, f.name, count(p.id), count(s.id)} |
| | 27 | (University |><| Faculty |><| Professor |><| Subject) |
| | 28 | }}} |
| | 29 | |
| | 30 | == Report 2: Student Activity and Advising Monitor == |
| | 31 | |
| | 32 | === Data requirements idea/concept title === |
| | 33 | |
| | 34 | '''Student Engagement Across Enrollment and Advice Modules''' |
| | 35 | |
| | 36 | === Data requirements description === |
| | 37 | |
| | 38 | This report combines two separate many-to-many relationships (student_subject and advice) into one view. It shows each student's home faculty, how many subjects they are currently enrolled in, and how many times they have requested advice from a professor. |
| | 39 | |
| | 40 | === Solution SQL === |
| | 41 | |
| | 42 | {{{ |
| | 43 | #!sql |
| | 44 | SELECTs.name || ' ' || s.surname AS student_name, s.index_number, f.name AS faculty_name, COUNT(DISTINCT ss.subj_id) AS enrolled_subjects, COUNT(DISTINCT a.id) AS advice_requests |
| | 45 | FROM student s JOIN faculty f ON s.facultyid = f.id LEFT JOIN student_subject ss ON s.id = ss.stud_id LEFT JOIN advice a ON s.id = a.student_id |
| | 46 | GROUP BY s.id, s.name, s.surname, s.index_number, f.name |
| | 47 | ORDER BY enrolled_subjects DESC; |
| | 48 | }}} |
| | 49 | |
| | 50 | === Solution Relational Algebra === |
| | 51 | |
| | 52 | {{{ |
| | 53 | gamma_{s.name, s.index_number, count(ss.subj_id), count(a.id)} |
| | 54 | (Student |><| Faculty |><| Student_Subject |><| Advice) |
| | 55 | }}} |
| | 56 | |
| | 57 | |
| | 58 | [[br]] |
| | 59 | |
| | 60 | [[br]] |
| | 61 | |
| | 62 | [[br]] |
| | 63 | |
| | 64 | = Advanced Reports AI Usage = |
| | 65 | |
| | 66 | Name of AI service: Gemini 3 Flash |
| | 67 | |
| | 68 | URL: https://gemini.google.com/ |
| | 69 | |
| | 70 | Type of service: Free Tier |
| | 71 | |
| | 72 | Final result: The AI was utilized to troubleshoot Trac Wiki rendering issues and to cross-reference my SQL logic against the established database schema to ensure naming consistency. |
| | 73 | |
| | 74 | Results in details: |
| | 75 | |
| | 76 | - Debugging Wiki Syntax: After encountering a "Failed to load processor" error in the wiki editor, I used the AI to identify that a specific newline character was missing after the #!sql declaration. |
| | 77 | |
| | 78 | - Schema Verification: I used the AI to double-check the join conditions between my junction tables. It helped verify that I was correctly using student_id for the advice table and stud_id for the student_subject table, matching my existing database implementation. |
| | 79 | |
| | 80 | - Relational Algebra Formatting: The AI assisted in converting my logical steps into a standard text-based format (gamma and |><|) that would display correctly within the university's wiki environment without breaking the layout. |
| | 81 | |
| | 82 | Entire AI usage log: |
| | 83 | |
| | 84 | - [User provided current table structures and SQL drafts] |
| | 85 | |
| | 86 | - [AI identified syntax errors in the Wiki markup] |
| | 87 | |
| | 88 | - [User and AI collaborated to ensure SQL queries aligned with existing project code without adding unnecessary features] |