· 7 years ago · Oct 23, 2018, 08:38 AM
1create table if not exists equipos (
2registro INT PRIMARY KEY AUTO_INCREMENT,
3nombre VARCHAR(30) NOT NULL,
4nombre_entrenador VARCHAR(35) NOT NULL,
5nombre_campo_futbol VARCHAR(30) NOT NULL,
6poblacion VARCHAR(25) NOT NULL,
7anio_fundacion INT(4) NOT NULL,
8anotaciones BLOB);
9create table if not exists partidos (
10registro INT PRIMARY KEY AUTO_INCREMENT,
11id_equipo1 INT(2) NOT NULL,
12resultado_equipo1 INT(2) NOT NULL,
13id_equipo2 INT(2) NOT NULL,
14resultado_equipo2 INT(2) NOT NULL);
15
16select equipos.nombre,partidos.*
17from equipos,partidos where((equipos.registro=partidos.id_equipo1)or(equipos.registro=partidos.id_equipo1))
18order by equipos.nombre;