-- Database schema
| divisions : division [ TEXT ] primary_key , name [ TEXT ] , country [ TEXT ] | matchs : Div [ TEXT ] matchs.Div = divisions.division , Date [ DATE ] , HomeTeam [ TEXT ] , AwayTeam [ TEXT ] , FTHG [ INTEGER ] , FTAG [ INTEGER ] , FTR [ TEXT ] , season [ INTEGER ] |
-- -- From the Spanish LaLiga division in the 2017 season, which team won the most times as a local team and by what percentage?

SELECT T1.HomeTeam HWHT , CAST(COUNT(CASE WHEN T1.FTR = 'H' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(HomeTeam) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'LaLiga' AND T2.country = 'Spain' AND T1.season = 2017;