matches_with_names <- matches %>% left_join(teams, by = c("home_team_id" = "team_id")) You can import the CSVs into SQLite, PostgreSQL, or MySQL. Example for SQLite:

.mode csv .import matches.csv matches .import teams.csv teams Then run queries like: fjelstul world cup database csv download