|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#16
|
||||
|
||||
|
Re: Jaci's Annual FRC Datadump 2016
If you export the database tables, the "sqlite_sequence" table lists the number of records in each table: Code:
event_types 7 match_levels 5 defenses 9 districts 8 events 139 alliances 1088 alliance_picks 3336 matches 13302 match_defenses 133020 match_teams 79812 match_scores 26604 awards 3251 stats 6194 rankings 6194 district_teams 1180 district_rankings 1179 district_event_points 2789 |
|
#17
|
|||
|
|||
|
Re: Jaci's Annual FRC Datadump 2016
Quote:
sqlite> select a.team, b.team, c.team, max(a.team+b.team+c.team) from match_teams a join match_teams b on a.match=b.match join match_teams c on b.match = c.match where a.team <> b.team and a.team <> c.team and b.team <> c.team and a.alliance_color = b.alliance_color and b.alliance_color = c.alliance_color ; 6138|6137|6208|18483 sqlite> select a.team, b.team, c.team, min(a.team+b.team+c.team) from match_teams a join match_teams b on a.match=b.match join match_teams c on b.match = c.match where a.team <> b.team and a.team <> c.team and b.team <> c.team and a.alliance_color = b.alliance_color and b.alliance_color = c.alliance_color ; 41|11|56|108 Last edited by jvriezen : 13-05-2016 at 16:43. Reason: Corrected to simply show SQL. |
|
#18
|
|||
|
|||
|
Re: Jaci's Annual FRC Datadump 2016
Quote:
sqlite> select a.team, b.team, c.team, max(a.team - c.team) from match_teams a join match_teams b on a.match=b.match and a.team > b.team join match_teams c on b.match = c.match and b.team > c.team where a.alliance_color = b.alliance_color and b.alliance_color = c.alliance_color ; 6231|5536|11|6220 Narrowest: sqlite> select a.team, b.team, c.team, min(a.team - c.team) from match_teams a join match_teams b on a.match=b.match and a.team > b.team join match_teams c on b.match = c.match and b.team > c.team where a.alliance_color = b.alliance_color and b.alliance_color = c.alliance_color ; 177|176|175|2 |
|
#19
|
|||
|
|||
|
Re: Jaci's Annual FRC Datadump 2016
Thank you
|
|
#20
|
|||
|
|||
|
Re: Jaci's Annual FRC Datadump 2016
Yay AWK, and once again showing there is more than one way to parse the data. I'm going to guess that Ether's was a little faster, since the data only will get a single read, the other method using SQL has quite a few joins.
|
|
#21
|
||||
|
||||
|
Re: Jaci's Annual FRC Datadump 2016
440 milliseconds on my 10-year-old Pentium D desktop running 32 bit XP.
|
|
#22
|
|||
|
|||
|
Re: Jaci's Annual FRC Datadump 2016
Quote:
|
|
#23
|
|||
|
|||
|
Re: Jaci's Annual FRC Datadump 2016
|
|
#24
|
||||
|
||||
|
Re: Jaci's Annual FRC Datadump 2016
Quote:
It's amazing how many tools there are to accomplish a given task. Always something new to learn. |
|
#25
|
||||
|
||||
|
Re: Jaci's Annual FRC Datadump 2016
Quote:
![]() Quote:
|
|
#26
|
|||
|
|||
|
Re: Jaci's Annual FRC Datadump 2016
I think there is a problem with jvriezen's SQL to get the max sum of team numbers on an alliance. I can't find a match where the 3 teams 6204|6191|6212 are on the same alliance. Here is my approach to answering this question:
select m.match, m.alliance_color, sum(m.team) as team_number_total from match_teams m group by m.match, m.alliance_color order by sum(m.team) desc It gives a descending order list with the winner being match 5986, blue alliance, team total 18483 (which agrees with Ether's answer). Last edited by antman : 13-05-2016 at 16:05. |
|
#27
|
||||
|
||||
|
Re: Jaci's Annual FRC Datadump 2016
Quote:
|
|
#28
|
|||
|
|||
|
Re: Jaci's Annual FRC Datadump 2016
Quote:
|
|
#29
|
||||
|
||||
|
Re: Jaci's Annual FRC Datadump 2016
Quote:
Code:
2662,444,blue,6083 2663,444,blue,4739 2664,444,blue,5331 2665,445,red,5876 2666,445,red,4729 2667,445,red,6191 2668,445,blue,6212 2669,445,blue,3132 2670,445,blue,6204 2671,446,red,6018 2672,446,red,4788 2673,446,red,4774 |
|
#30
|
|||
|
|||
|
Re: Jaci's Annual FRC Datadump 2016
Question for Ether or anyone else interested: is there a simple way using awk or other tools to get information about streaks from relational data like this? I've always resorted to writing a program (VB, T-SQL, java etc) because the SQL gets too ugly. For example: longest winning streak for each team (crossing events). It would be hard to do with this data currently because the event dates are not included but easy enough to add event_date field to the events table. To simplify my question, assuming id in the matches table was in chronological order for each team, how would you approach getting each team's longest winning streak?
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|