Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE DATABASE `bdfutbol`
- CREATE TABLE `equipo` (
- `id_equipo` int NOT NULL,
- `nombre_equipo` varchar(45) NOT NULL,
- `ciudad` varchar(45) NOT NULL,
- `web_oficial` varchar(45) DEFAULT NULL,
- `Puntos` int DEFAULT NULL,
- PRIMARY KEY (`id_equipo`)
- )
- CREATE TABLE `jugador` (
- `id_jugador` int NOT NULL,
- `nombre` varchar(45) NOT NULL,
- `apellido` varchar(45) NOT NULL,
- `id_capitan` int NOT NULL,
- `posicion` int NOT NULL,
- `fecha_alta` datetime NOT NULL,
- `salario_bruto` int NOT NULL,
- `id_equipo` int NOT NULL,
- PRIMARY KEY (`id_jugador`,`id_capitan`),
- KEY `equipo/jugador_idx` (`id_equipo`),
- CONSTRAINT `equipo/jugador` FOREIGN KEY (`id_equipo`) REFERENCES `equipo` (`id_equipo`)
- )
- CREATE TABLE `partido` (
- `evisitante` int NOT NULL,
- `elocal` int NOT NULL,
- `resultado` varchar(45) NOT NULL,
- `fecha` datetime NOT NULL,
- `arbitro` int NOT NULL,
- `id_equipo` int NOT NULL,
- KEY `partido/equipo_idx` (`id_equipo`),
- KEY `partido/equipovis_idx` (`evisitante`),
- KEY `partido/equipoloc_idx` (`elocal`),
- CONSTRAINT `partido/equipo` FOREIGN KEY (`id_equipo`) REFERENCES `equipo` (`id_equipo`),
- CONSTRAINT `partido/equipoloc` FOREIGN KEY (`elocal`) REFERENCES `equipo` (`id_equipo`),
- CONSTRAINT `partido/equipovis` FOREIGN KEY (`evisitante`) REFERENCES `equipo` (`id_equipo`)
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement