| 3 | == Извештај за турнири, информации за кои решавачи учествувале на тие турнири, кои квизови ги решавале, колку поени освоиле, како и кој медали ги освоиле |
| 4 | |
| 5 | |
| 6 | {{{ |
| 7 | select us.userID, |
| 8 | us.username, |
| 9 | t.tournamentname, |
| 10 | q.quizname, |
| 11 | rt.points, |
| 12 | a.attemptdate, |
| 13 | m.medalname |
| 14 | |
| 15 | from quizTaker_participates_in_tournament as qtou |
| 16 | |
| 17 | left join quiztaker as qt |
| 18 | on qtou.userID=qt.userID |
| 19 | left join tournament t |
| 20 | on qtou.tournamentid = t.tournamentid |
| 21 | left join user_table as us |
| 22 | on qt.userID=us.userID |
| 23 | left join attempt a |
| 24 | on us.userid = a.userid |
| 25 | left join result_table rt |
| 26 | on rt.attemptid = a.attemptid |
| 27 | left join quiz q |
| 28 | on a.quizid = q.quizid |
| 29 | join quiz_is_part_of_tournament qipot |
| 30 | on q.quizid = qipot.quizid and t.tournamentid = qipot.tournamentid |
| 31 | left join medal_is_awarded_to_quiztaker miatq |
| 32 | on qt.userid = miatq.userid |
| 33 | left join medal m |
| 34 | on m.medalid = miatq.medalid and m.tournamentid = qtou.tournamentid |
| 35 | order by rt.points |
| 36 | }}} |
| 37 | |
| 38 | == Вкупен број на организирани турнири, играчи и медали |
| 39 | |
| 40 | |
| 41 | {{{ |
| 42 | select tou.tournamentname as t_name, |
| 43 | count(distinct qtpt.userid) as total_players, |
| 44 | count(distinct qipot.quizid) as total_quizzes, |
| 45 | count(distinct m.medalid) as total_medals |
| 46 | |
| 47 | from tournament tou |
| 48 | |
| 49 | left join quizTaker_participates_in_tournament qtpt |
| 50 | on tou.tournamentid=qtpt.tournamentid |
| 51 | left join quiz_is_part_of_tournament qipot |
| 52 | on qipot.tournamentid = tou.tournamentid |
| 53 | left join attempt a |
| 54 | on a.quizid = qipot.quizid |
| 55 | left join result_table rt |
| 56 | on rt.attemptid = a.attemptid |
| 57 | left join medal m |
| 58 | on m.tournamentid = tou.tournamentid |
| 59 | group by 1 |
| 60 | order by t_name |
| 61 | |
| 62 | }}} |
| 63 | |
| 64 | |
| 65 | |
| 66 | |