Help.docx
Document Details
Uploaded by ExpansiveNewYork8367
Tags
Full Transcript
Must do The database has major problems escpecially with the events table We gonna have to fix that Also we renamed points to point Fix that \`events\_ibfk\_1\` SELECT Name, Event, SUM(Points) AS TotalPoints FROM participants, points JOIN points ON ParticipantID = ParticipantID WHERE p.Gend...
Must do The database has major problems escpecially with the events table We gonna have to fix that Also we renamed points to point Fix that \`events\_ibfk\_1\` SELECT Name, Event, SUM(Points) AS TotalPoints FROM participants, points JOIN points ON ParticipantID = ParticipantID WHERE p.Gender = \'Female\' GROUP BY ParticipantID, Name, Event ORDER BY TotalPoints DESC LIMIT 1 SELECT ParticipantID.Name , Event, SUM(PointID.points) AS TotalPoints FROM participants, points JOIN points ON ParticipantID = ParticipantID WHERE Gender = \'Female\' GROUP BY ParticipantID, Name, Event ORDER BY TotalPoints DESC LIMIT 1 String query = \"SELECT AgeGroup FROM events\"; String AgeGroup = null; // Initialize AgeGroup outside the if-else blocks // Method to get the best Athlete from each age group try (Connection connection = getConnection(); Statement statement = connection.createStatement(); ResultSet rs = statement.executeQuery(query)) { if (rs.next()) { String AGV = rs.getString(\"AgeGroup\"); if (AGV.contains(\"under 13\")) { String Query = \" SELECT PointID, Name, Event, Sum(Points) AS TP \" \+ \" FROM points \" \+ \" Group by Name \" \+ \" ORDER BY TP DESC \" \+ \" LIMIT 1 \"; // SQL query to get best athlete int PointID = rs.getInt(\"PointID\"); String Name = rs.getString(\"Name\"); String Event = rs.getString(\"Event\"); int points = rs.getInt(\"points\"); AgeGroup = Name + \"\\n\" + \" With \" + points + \" Points\" ; } } } catch(SQLException D) { AgeGroup = (\"An error in the database occurred : \" + D.getMessage()); } catch (Exception D) { AgeGroup = (\"An unexpected error occurred : \" + D.getMessage()); } return AgeGroup;