DROP TABLE IF EXISTS games;
CREATE TABLE games (
    id          INTEGER  PRIMARY KEY,
    round_game  INTEGER  NOT NULL,
    hometeam    TEXT     NOT NULL,
    awayteam    TEXT     NOT NULL,
    homegoals   INTEGER  NOT NULL,
    awaygoals   INTEGER  NOT NULL
);

INSERT INTO games (round_game, hometeam, awayteam, homegoals, awaygoals) VALUES
(101,'Athletic Bilbao','Leganes',2,1),
(102,'Valencia','Atletico Madrid',1,1),
(103,'Real Madrid','Getafe',2,0),
(104,'Rayo Vallecano','Sevilla',1,4),
(105,'Eibar','Huesca',1,2),
(106,'Barcelona','Alaves',3,0),
(107,'Villarreal','Real Sociedad',1,2),
(108,'Celta Vigo','Espanyol',1,1),
(109,'Real Betis','Levante',0,3),
(110,'Girona','Valladolid',0,0),
(201,'Athletic Bilbao','Huesca',2,2),
(202,'Levante','Celta Vigo',1,2),
(203,'Sevilla','Villarreal',0,0),
(204,'Girona','Real Madrid',1,4),
(205,'Espanyol','Valencia',2,0),
(206,'Valladolid','Barcelona',0,1),
(207,'Atletico Madrid','Rayo Vallecano',1,0),
(208,'Alaves','Real Betis',0,0),
(209,'Leganes','Real Sociedad',2,2),
(210,'Getafe','Eibar',2,0),
(301,'Rayo Vallecano','Athletic Bilbao',1,1),
(302,'Real Betis','Sevilla',1,0),
(303,'Barcelona','Huesca',8,2),
(304,'Alaves','Espanyol',2,1),
(305,'Levante','Valencia',2,2),
(306,'Real Madrid','Leganes',4,1),
(307,'Celta Vigo','Atletico Madrid',2,0),
(308,'Villarreal','Girona',0,1),
(309,'Eibar','Real Sociedad',2,1),
(310,'Getafe','Valladolid',0,0),
(401,'Girona','Celta Vigo',3,2),
(402,'Sevilla','Getafe',0,2),
(403,'Valladolid','Alaves',0,1),
(404,'Espanyol','Levante',1,0),
(405,'Leganes','Villarreal',0,1),
(406,'Athletic Bilbao','Real Madrid',1,1),
(407,'Valencia','Real Betis',0,0),
(408,'Real Sociedad','Barcelona',1,2),
(409,'Atletico Madrid','Eibar',1,1),
(410,'Huesca','Rayo Vallecano',0,1),
(501,'Barcelona','Girona',2,2),
(502,'Real Betis','Athletic Bilbao',2,2),
(503,'Villarreal','Valencia',0,0),
(504,'Levante','Sevilla',2,6),
(505,'Real Madrid','Espanyol',1,0),
(506,'Getafe','Atletico Madrid',0,2),
(507,'Eibar','Leganes',1,0),
(508,'Celta Vigo','Valladolid',3,3),
(509,'Rayo Vallecano','Alaves',1,5),
(510,'Huesca','Real Sociedad',0,1),
(601,'Girona','Real Betis',0,1),
(602,'Alaves','Getafe',1,1),
(603,'Valladolid','Levante',2,1),
(604,'Valencia','Celta Vigo',1,1),
(605,'Sevilla','Real Madrid',3,0),
(606,'Leganes','Barcelona',2,1),
(607,'Athletic Bilbao','Villarreal',0,3),
(608,'Atletico Madrid','Huesca',3,0),
(609,'Real Sociedad','Rayo Vallecano',2,2),
(610,'Espanyol','Eibar',1,0),
(701,'Celta Vigo','Getafe',1,1),
(702,'Real Betis','Leganes',1,0),
(703,'Levante','Alaves',2,1),
(704,'Villarreal','Valladolid',0,1),
(705,'Huesca','Girona',1,1),
(706,'Real Madrid','Atletico Madrid',0,0),
(707,'Eibar','Sevilla',1,3),
(708,'Barcelona','Athletic Bilbao',1,1),
(709,'Real Sociedad','Valencia',0,1),
(710,'Rayo Vallecano','Espanyol',2,2),
(801,'Valencia','Barcelona',1,1),
(802,'Sevilla','Celta Vigo',2,1),
(803,'Espanyol','Villarreal',3,1),
(804,'Atletico Madrid','Real Betis',1,0),
(805,'Valladolid','Huesca',1,0),
(806,'Leganes','Rayo Vallecano',1,0),
(807,'Alaves','Real Madrid',1,0),
(808,'Getafe','Levante',0,1),
(809,'Girona','Eibar',2,3),
(810,'Athletic Bilbao','Real Sociedad',1,3),
(901,'Real Sociedad','Girona',0,0),
(902,'Real Betis','Valladolid',0,1),
(903,'Huesca','Espanyol',0,2),
(904,'Eibar','Athletic Bilbao',1,1),
(905,'Rayo Vallecano','Getafe',1,2),
(906,'Barcelona','Sevilla',4,2),
(907,'Villarreal','Atletico Madrid',1,1),
(908,'Valencia','Leganes',1,1),
(909,'Real Madrid','Levante',1,2),
(910,'Celta Vigo','Alaves',0,1),
(1001,'Sevilla','Huesca',2,1),
(1002,'Alaves','Villarreal',2,1),
(1003,'Barcelona','Real Madrid',5,1),
(1004,'Getafe','Real Betis',2,0),
(1005,'Atletico Madrid','Real Sociedad',2,0),
(1006,'Celta Vigo','Eibar',4,0),
(1007,'Levante','Leganes',2,0),
(1008,'Athletic Bilbao','Valencia',0,0),
(1009,'Girona','Rayo Vallecano',2,1),
(1010,'Valladolid','Espanyol',1,1),
(1101,'Espanyol','Athletic Bilbao',1,0),
(1102,'Real Betis','Celta Vigo',3,3),
(1103,'Huesca','Getafe',1,1),
(1104,'Real Sociedad','Sevilla',0,0),
(1105,'Villarreal','Levante',1,1),
(1106,'Eibar','Alaves',2,1),
(1107,'Rayo Vallecano','Barcelona',2,3),
(1108,'Valencia','Girona',0,1),
(1109,'Real Madrid','Valladolid',2,0),
(1110,'Leganes','Atletico Madrid',1,1),
(1201,'Celta Vigo','Real Madrid',2,4),
(1202,'Rayo Vallecano','Villarreal',2,2),
(1203,'Sevilla','Espanyol',2,1),
(1204,'Barcelona','Real Betis',3,4),
(1205,'Alaves','Huesca',2,1),
(1206,'Girona','Leganes',0,0),
(1207,'Atletico Madrid','Athletic Bilbao',3,2),
(1208,'Getafe','Valencia',0,1),
(1209,'Valladolid','Eibar',0,0),
(1210,'Levante','Real Sociedad',1,3),
(1301,'Real Sociedad','Celta Vigo',2,1),
(1302,'Villarreal','Real Betis',2,1),
(1303,'Espanyol','Girona',1,3),
(1304,'Sevilla','Valladolid',1,0),
(1305,'Athletic Bilbao','Getafe',1,1),
(1306,'Atletico Madrid','Barcelona',1,1),
(1307,'Huesca','Levante',2,2),
(1308,'Valencia','Rayo Vallecano',3,0),
(1309,'Eibar','Real Madrid',3,0),
(1310,'Leganes','Alaves',1,0),
(1401,'Levante','Athletic Bilbao',3,0),
(1402,'Alaves','Sevilla',1,1),
(1403,'Barcelona','Villarreal',2,0),
(1404,'Girona','Atletico Madrid',1,1),
(1405,'Real Betis','Real Sociedad',1,0),
(1406,'Real Madrid','Valencia',2,0),
(1407,'Getafe','Espanyol',3,0),
(1408,'Valladolid','Leganes',2,4),
(1409,'Celta Vigo','Huesca',2,0),
(1410,'Rayo Vallecano','Eibar',1,0),
(1501,'Athletic Bilbao','Girona',1,0),
(1502,'Real Betis','Rayo Vallecano',2,0),
(1503,'Real Sociedad','Valladolid',1,2),
(1504,'Huesca','Real Madrid',0,1),
(1505,'Eibar','Levante',4,4),
(1506,'Espanyol','Barcelona',0,4),
(1507,'Villarreal','Celta Vigo',2,3),
(1508,'Valencia','Sevilla',1,1),
(1509,'Atletico Madrid','Alaves',3,0),
(1510,'Leganes','Getafe',1,1),
(1601,'Alaves','Athletic Bilbao',0,0),
(1602,'Levante','Barcelona',0,5),
(1603,'Huesca','Villarreal',2,2),
(1604,'Espanyol','Real Betis',1,3),
(1605,'Sevilla','Girona',2,0),
(1606,'Eibar','Valencia',1,1),
(1607,'Real Madrid','Rayo Vallecano',1,0),
(1608,'Valladolid','Atletico Madrid',2,3),
(1609,'Getafe','Real Sociedad',1,0),
(1610,'Celta Vigo','Leganes',0,0),
(1701,'Villarreal','Real Madrid',2,2),
(1702,'Rayo Vallecano','Levante',2,1),
(1703,'Leganes','Sevilla',1,1),
(1704,'Valencia','Huesca',2,1),
(1705,'Athletic Bilbao','Valladolid',1,1),
(1706,'Barcelona','Celta Vigo',2,0),
(1707,'Atletico Madrid','Espanyol',1,0),
(1708,'Real Betis','Eibar',1,1),
(1709,'Real Sociedad','Alaves',0,1),
(1710,'Girona','Getafe',1,1),
(1801,'Celta Vigo','Athletic Bilbao',1,2),
(1802,'Getafe','Barcelona',1,2),
(1803,'Real Madrid','Real Sociedad',0,2),
(1804,'Sevilla','Atletico Madrid',1,1),
(1805,'Eibar','Villarreal',0,0),
(1806,'Huesca','Real Betis',2,1),
(1807,'Alaves','Valencia',2,1),
(1808,'Valladolid','Rayo Vallecano',0,1),
(1809,'Espanyol','Leganes',1,0),
(1810,'Levante','Girona',2,2),
(1901,'Real Sociedad','Espanyol',3,2),
(1902,'Real Betis','Real Madrid',1,2),
(1903,'Barcelona','Eibar',3,0),
(1904,'Athletic Bilbao','Sevilla',2,0),
(1905,'Atletico Madrid','Levante',1,0),
(1906,'Villarreal','Getafe',1,2),
(1907,'Girona','Alaves',1,1),
(1908,'Valencia','Valladolid',1,1),
(1909,'Leganes','Huesca',1,0),
(1910,'Rayo Vallecano','Celta Vigo',4,2),
(2001,'Eibar','Espanyol',3,0),
(2002,'Barcelona','Leganes',3,1),
(2003,'Rayo Vallecano','Real Sociedad',2,2),
(2004,'Levante','Valladolid',2,0),
(2005,'Villarreal','Athletic Bilbao',1,1),
(2006,'Real Betis','Girona',3,2),
(2007,'Celta Vigo','Valencia',1,2),
(2008,'Huesca','Atletico Madrid',0,3),
(2009,'Real Madrid','Sevilla',2,0),
(2010,'Getafe','Alaves',4,0),
(2101,'Alaves','Rayo Vallecano',0,1),
(2102,'Espanyol','Real Madrid',2,4),
(2103,'Real Sociedad','Huesca',0,0),
(2104,'Athletic Bilbao','Real Betis',1,0),
(2105,'Girona','Barcelona',0,2),
(2106,'Valladolid','Celta Vigo',2,1),
(2107,'Valencia','Villarreal',3,0),
(2108,'Leganes','Eibar',2,2),
(2109,'Atletico Madrid','Getafe',2,0),
(2110,'Sevilla','Levante',5,0),
(2201,'Rayo Vallecano','Leganes',1,2),
(2202,'Real Madrid','Alaves',3,0),
(2203,'Eibar','Girona',3,0),
(2204,'Real Betis','Atletico Madrid',1,0),
(2205,'Villarreal','Espanyol',2,2),
(2206,'Celta Vigo','Sevilla',1,0),
(2207,'Barcelona','Valencia',2,2),
(2208,'Real Sociedad','Athletic Bilbao',2,1),
(2209,'Levante','Getafe',0,0),
(2210,'Huesca','Valladolid',4,0),
(2301,'Alaves','Levante',2,0),
(2302,'Athletic Bilbao','Barcelona',0,0),
(2303,'Sevilla','Eibar',2,2),
(2304,'Valencia','Real Sociedad',0,0),
(2305,'Leganes','Real Betis',3,0),
(2306,'Girona','Huesca',0,2),
(2307,'Espanyol','Rayo Vallecano',2,1),
(2308,'Atletico Madrid','Real Madrid',1,3),
(2309,'Getafe','Celta Vigo',3,1),
(2310,'Valladolid','Villarreal',0,0),
(2401,'Huesca','Athletic Bilbao',0,1),
(2402,'Real Betis','Alaves',1,1),
(2403,'Villarreal','Sevilla',3,0),
(2404,'Valencia','Espanyol',0,0),
(2405,'Real Madrid','Girona',1,2),
(2406,'Barcelona','Valladolid',1,0),
(2407,'Real Sociedad','Leganes',3,0),
(2408,'Rayo Vallecano','Atletico Madrid',0,1),
(2409,'Celta Vigo','Levante',1,4),
(2410,'Eibar','Getafe',2,2),
(2501,'Girona','Real Sociedad',0,0),
(2502,'Levante','Real Madrid',1,2),
(2503,'Valladolid','Real Betis',0,2),
(2504,'Atletico Madrid','Villarreal',2,0),
(2505,'Leganes','Valencia',1,1),
(2506,'Athletic Bilbao','Eibar',1,0),
(2507,'Alaves','Celta Vigo',0,0),
(2508,'Sevilla','Barcelona',2,4),
(2509,'Getafe','Rayo Vallecano',2,1),
(2510,'Espanyol','Huesca',1,1),
(2601,'Leganes','Levante',1,0),
(2602,'Valencia','Athletic Bilbao',2,0),
(2603,'Real Sociedad','Atletico Madrid',0,2),
(2604,'Real Betis','Getafe',1,2),
(2605,'Eibar','Celta Vigo',1,0),
(2606,'Real Madrid','Barcelona',0,1),
(2607,'Huesca','Sevilla',2,1),
(2608,'Villarreal','Alaves',1,2),
(2609,'Espanyol','Valladolid',3,1),
(2610,'Rayo Vallecano','Girona',0,2),
(2701,'Valladolid','Real Madrid',1,4),
(2702,'Levante','Villarreal',0,2),
(2703,'Sevilla','Real Sociedad',5,2),
(2704,'Girona','Valencia',2,3),
(2705,'Celta Vigo','Real Betis',0,1),
(2706,'Getafe','Huesca',2,1),
(2707,'Barcelona','Rayo Vallecano',3,1),
(2708,'Atletico Madrid','Leganes',1,0),
(2709,'Alaves','Eibar',1,1),
(2710,'Athletic Bilbao','Espanyol',1,1),
(2801,'Real Betis','Barcelona',1,4),
(2802,'Valencia','Getafe',0,0),
(2803,'Villarreal','Rayo Vallecano',3,1),
(2804,'Espanyol','Sevilla',0,1),
(2805,'Eibar','Valladolid',1,2),
(2806,'Leganes','Girona',0,2),
(2807,'Athletic Bilbao','Atletico Madrid',2,0),
(2808,'Real Madrid','Celta Vigo',2,0),
(2809,'Huesca','Alaves',1,3),
(2810,'Real Sociedad','Levante',1,1),
(2901,'Real Madrid','Huesca',3,2),
(2902,'Valladolid','Real Sociedad',1,1),
(2903,'Sevilla','Valencia',0,1),
(2904,'Rayo Vallecano','Real Betis',1,1),
(2905,'Levante','Eibar',2,2),
(2906,'Alaves','Atletico Madrid',0,4),
(2907,'Celta Vigo','Villarreal',3,2),
(2908,'Barcelona','Espanyol',2,0),
(2909,'Getafe','Leganes',0,2),
(2910,'Girona','Athletic Bilbao',1,2),
(3001,'Real Sociedad','Real Betis',2,1),
(3002,'Leganes','Valladolid',1,0),
(3003,'Sevilla','Alaves',2,0),
(3004,'Valencia','Real Madrid',2,1),
(3005,'Huesca','Celta Vigo',3,3),
(3006,'Eibar','Rayo Vallecano',2,1),
(3007,'Athletic Bilbao','Levante',3,2),
(3008,'Villarreal','Barcelona',4,4),
(3009,'Espanyol','Getafe',1,1),
(3010,'Atletico Madrid','Girona',2,0),
(3101,'Real Betis','Villarreal',2,1),
(3102,'Levante','Huesca',2,2),
(3103,'Celta Vigo','Real Sociedad',3,1),
(3104,'Valladolid','Sevilla',0,2),
(3105,'Getafe','Athletic Bilbao',1,0),
(3106,'Alaves','Leganes',1,1),
(3107,'Barcelona','Atletico Madrid',2,0),
(3108,'Rayo Vallecano','Valencia',2,0),
(3109,'Real Madrid','Eibar',2,1),
(3110,'Girona','Espanyol',1,2),
(3201,'Leganes','Real Madrid',1,1),
(3202,'Valencia','Levante',3,1),
(3203,'Girona','Villarreal',0,1),
(3204,'Real Sociedad','Eibar',1,1),
(3205,'Athletic Bilbao','Rayo Vallecano',3,2),
(3206,'Valladolid','Getafe',2,2),
(3207,'Sevilla','Real Betis',3,2),
(3208,'Atletico Madrid','Celta Vigo',2,0),
(3209,'Huesca','Barcelona',0,0),
(3210,'Espanyol','Alaves',2,1),
(3301,'Real Betis','Valencia',1,2),
(3302,'Villarreal','Leganes',2,1),
(3303,'Real Madrid','Athletic Bilbao',3,0),
(3304,'Getafe','Sevilla',3,0),
(3305,'Levante','Espanyol',2,2),
(3306,'Barcelona','Real Sociedad',2,1),
(3307,'Rayo Vallecano','Huesca',0,0),
(3308,'Eibar','Atletico Madrid',0,1),
(3309,'Celta Vigo','Girona',2,1),
(3310,'Alaves','Valladolid',2,2),
(3401,'Getafe','Real Madrid',0,0),
(3402,'Real Sociedad','Villarreal',0,1),
(3403,'Sevilla','Rayo Vallecano',5,0),
(3404,'Levante','Real Betis',4,0),
(3405,'Leganes','Athletic Bilbao',0,1),
(3406,'Espanyol','Celta Vigo',1,1),
(3407,'Atletico Madrid','Valencia',3,2),
(3408,'Alaves','Barcelona',0,2),
(3409,'Valladolid','Girona',1,0),
(3410,'Huesca','Eibar',2,0),
(3501,'Real Betis','Espanyol',1,1),
(3502,'Rayo Vallecano','Real Madrid',1,0),
(3503,'Villarreal','Huesca',1,1),
(3504,'Real Sociedad','Getafe',2,1),
(3505,'Girona','Sevilla',1,0),
(3506,'Valencia','Eibar',0,1),
(3507,'Barcelona','Levante',1,0),
(3508,'Leganes','Celta Vigo',0,0),
(3509,'Atletico Madrid','Valladolid',1,0),
(3510,'Athletic Bilbao','Alaves',1,1),
(3601,'Huesca','Valencia',2,6),
(3602,'Valladolid','Athletic Bilbao',1,0),
(3603,'Real Madrid','Villarreal',3,2),
(3604,'Eibar','Real Betis',1,0),
(3605,'Getafe','Girona',2,0),
(3606,'Celta Vigo','Barcelona',2,0),
(3607,'Alaves','Real Sociedad',0,1),
(3608,'Espanyol','Atletico Madrid',3,0),
(3609,'Levante','Rayo Vallecano',4,1),
(3610,'Sevilla','Leganes',0,3),
(3701,'Athletic Bilbao','Celta Vigo',3,1),
(3702,'Leganes','Espanyol',0,2),
(3703,'Villarreal','Eibar',1,0),
(3704,'Valencia','Alaves',3,1),
(3705,'Rayo Vallecano','Valladolid',1,2),
(3706,'Girona','Levante',1,2),
(3707,'Real Betis','Huesca',2,1),
(3708,'Barcelona','Getafe',2,0),
(3709,'Atletico Madrid','Sevilla',1,1),
(3710,'Real Sociedad','Real Madrid',3,1),
(3801,'Eibar','Barcelona',2,2),
(3802,'Real Madrid','Real Betis',0,2),
(3803,'Alaves','Girona',2,1),
(3804,'Huesca','Leganes',2,1),
(3805,'Celta Vigo','Rayo Vallecano',2,2),
(3806,'Sevilla','Athletic Bilbao',2,0),
(3807,'Getafe','Villarreal',2,2),
(3808,'Espanyol','Real Sociedad',2,0),
(3809,'Valladolid','Valencia',0,2),
(3810,'Levante','Atletico Madrid',2,2)
;

ANALYZE games;