csy3024-assignment-1/scripts/queries/query8.cyp

8 lines
466 B
Plaintext

//Display the top 5 teams with the best half time result
MATCH (t:Team)-[p:PLAYED_IN]->(m:Match)
WHERE m.half_time_scores[0] > m.half_time_scores[1] AND p.played = "Home"
OR m.half_time_scores[0] < m.half_time_scores[1] AND p.played = "Away"
RETURN t.name AS best_half_time_result, m.half_time_scores[0] AS home_score, m.half_time_scores[1] AS away_score, ABS(m.half_time_scores[0] - m.half_time_scores[1]) AS score_difference
ORDER BY score_difference DESC
LIMIT 5