Database: hockey
Tables: AwardsMisc, HOF, Teams, Coaches, AwardsCoaches, Master, AwardsPlayers, CombinedShutouts, Goalies, GoaliesSC, GoaliesShootout, Scoring, ScoringSC, ScoringShootout, ScoringSup, SeriesPost, TeamSplits, TeamVsTeam, TeamsHalf, TeamsPost, TeamsSC, abbrev
Columns (table index, column name): -1, *, 0, name, 0, ID, 0, award, 0, year, 0, lgID, 0, note, 1, year, 1, hofID, 1, name, 1, category, 2, year, 2, lgID, 2, tmID, 2, franchID, 2, confID, 2, divID, 2, rank, 2, playoff, 2, G, 2, W, 2, L, 2, T, 2, OTL, 2, Pts, 2, SoW, 2, SoL, 2, GF, 2, GA, 2, name, 2, PIM, 2, BenchMinor, 2, PPG, 2, PPC, 2, SHA, 2, PKG, 2, PKC, 2, SHF, 3, coachID, 3, year, 3, tmID, 3, lgID, 3, stint, 3, notes, 3, g, 3, w, 3, l, 3, t, 3, postg, 3, postw, 3, postl, 3, postt, 4, coachID, 4, award, 4, year, 4, lgID, 4, note, 5, playerID, 5, coachID, 5, hofID, 5, firstName, 5, lastName, 5, nameNote, 5, nameGiven, 5, nameNick, 5, height, 5, weight, 5, shootCatch, 5, legendsID, 5, ihdbID, 5, hrefID, 5, firstNHL, 5, lastNHL, 5, firstWHA, 5, lastWHA, 5, pos, 5, birthYear, 5, birthMon, 5, birthDay, 5, birthCountry, 5, birthState, 5, birthCity, 5, deathYear, 5, deathMon, 5, deathDay, 5, deathCountry, 5, deathState, 5, deathCity, 6, playerID, 6, award, 6, year, 6, lgID, 6, note, 6, pos, 7, year, 7, month, 7, date, 7, tmID, 7, oppID, 7, R/P, 7, IDgoalie1, 7, IDgoalie2, 8, playerID, 8, year, 8, stint, 8, tmID, 8, lgID, 8, GP, 8, Min, 8, W, 8, L, 8, T/OL, 8, ENG, 8, SHO, 8, GA, 8, SA, 8, PostGP, 8, PostMin, 8, PostW, 8, PostL, 8, PostT, 8, PostENG, 8, PostSHO, 8, PostGA, 8, PostSA, 9, playerID, 9, year, 9, tmID, 9, lgID, 9, GP, 9, Min, 9, W, 9, L, 9, T, 9, SHO, 9, GA, 10, playerID, 10, year, 10, stint, 10, tmID, 10, W, 10, L, 10, SA, 10, GA, 11, playerID, 11, year, 11, stint, 11, tmID, 11, lgID, 11, pos, 11, GP, 11, G, 11, A, 11, Pts, 11, PIM, 11, +/-, 11, PPG, 11, PPA, 11, SHG, 11, SHA, 11, GWG, 11, GTG, 11, SOG, 11, PostGP, 11, PostG, 11, PostA, 11, PostPts, 11, PostPIM, 11, Post+/-, 11, PostPPG, 11, PostPPA, 11, PostSHG, 11, PostSHA, 11, PostGWG, 11, PostSOG, 12, playerID, 12, year, 12, tmID, 12, lgID, 12, pos, 12, GP, 12, G, 12, A, 12, Pts, 12, PIM, 13, playerID, 13, year, 13, stint, 13, tmID, 13, S, 13, G, 13, GDG, 14, playerID, 14, year, 14, PPA, 14, SHA, 15, year, 15, round, 15, series, 15, tmIDWinner, 15, lgIDWinner, 15, tmIDLoser, 15, lgIDLoser, 15, W, 15, L, 15, T, 15, GoalsWinner, 15, GoalsLoser, 15, note, 16, year, 16, lgID, 16, tmID, 16, hW, 16, hL, 16, hT, 16, hOTL, 16, rW, 16, rL, 16, rT, 16, rOTL, 16, SepW, 16, SepL, 16, SepT, 16, SepOL, 16, OctW, 16, OctL, 16, OctT, 16, OctOL, 16, NovW, 16, NovL, 16, NovT, 16, NovOL, 16, DecW, 16, DecL, 16, DecT, 16, DecOL, 16, JanW, 16, JanL, 16, JanT, 16, JanOL, 16, FebW, 16, FebL, 16, FebT, 16, FebOL, 16, MarW, 16, MarL, 16, MarT, 16, MarOL, 16, AprW, 16, AprL, 16, AprT, 16, AprOL, 17, year, 17, lgID, 17, tmID, 17, oppID, 17, W, 17, L, 17, T, 17, OTL, 18, year, 18, lgID, 18, tmID, 18, half, 18, rank, 18, G, 18, W, 18, L, 18, T, 18, GF, 18, GA, 19, year, 19, lgID, 19, tmID, 19, G, 19, W, 19, L, 19, T, 19, GF, 19, GA, 19, PIM, 19, BenchMinor, 19, PPG, 19, PPC, 19, SHA, 19, PKG, 19, PKC, 19, SHF, 20, year, 20, lgID, 20, tmID, 20, G, 20, W, 20, L, 20, T, 20, GF, 20, GA, 20, PIM, 21, Type, 21, Code, 21, Fullname
Question: How many games did the coach who received the first-ever Second Team All-Star award play before receiving such award?
Evidence: first-ever Second Team All-Star award refers to min(year(award = 'Second Team All-Star')); How many games before receiving such award = sum(g(coachID(min(year(award = 'Second Team All-Star')))): g(min(year)))
SQL: SELECT SUM(T1.g) FROM Coaches AS T1 INNER JOIN ( SELECT coachID, year FROM AwardsCoaches WHERE award = 'Second Team All-Star' ORDER BY year LIMIT 1 ) AS T2 ON T1.coachID = T2.coachID AND T1.year < T2.year