Está en la página 1de 33

Título del Trabajo:

Nombre Alumno:

Nombre Asignatura: Taller de base de datos

Instituto AIEP

Ponga la fecha aquí


Introducción

Lo que veremos en este trabajo será la toma de requerimientos para lo que es un sistema de base de datos,
donde el usuario quiere que estén registrados todos los sucesos que ocurren en la actualidad en el futbol
profesional UEFA sean los equipos que están clasificados, los nombres de las ligas, nombres de los jugadores,
nombre de los entrenadores, de los árbitros, además de todas las faltas y sanciones que van ocurriendo
durante el transcurso del partido.

La toma de requerimientos se realizo con un formato de historias de usuario (papel donde dice el cómo y para
que quiere lo que esta pidiendo)

La segunda parte es la normalización de todos los requisitos impuestos por el usuario para tener un diagrama
con los datos exactos y no tener redundancia e inconsistencia.

Desarrollo
Toma de requerimientos:

Lo que el usuario quiere, es tener un registro de los goles realizados por los equipos de futbol en el partido, para esto
necesitaremos agregar varias tablas con los datos de cada equipo y sus jugadores además de un sistema que registre
todos los goles indicando el jugador con su nombre y edad, el minuto del gol y el tipo de gol. Además de todo lo
nombrado se quiere llevar un registro de todos los equipos que van clasificando y almacenar el registro de cada partido
que se ha jugado, con el código del partido, el código de la liga, el código del equipo y el código del jugador.

Requerimientos funcionales:

- El sistema deberá ser fácil de usar, para que cualquier persona pueda ingresar y realizar una revisión de la
información de los equipos de futbol
- El sistema debe mostrar todos los datos de los equipos y cuáles son los que están clasificados y cuales no
- Tener la información de los equipos que van a jugar y el tipo de partido
- Tener la programación de los partidos que se van a jugar
- saber la nacionalidad del árbitro de los jugadores y del entrenador

Requerimientos no funcionales:

- Velocidad de respuesta al usuario y a eventos


- Capacidad de almacenamiento
- Número de usuarios simultáneos
- un buscador

HU01- REGISTRO DE GOL


como: usuario
quiero: Registrar los goles realizados por un equipo en el partido

para: Llevar un registro de goles indicando el jugador, el partido el minuto del gol y el tipo de gol
condiciones
:
-Tener equipos clasificados

-almacenar el registro de los partidos


-almacenar el Código del partido, el Código de la liga, el código del equipo, el código del jugador, el minuto del gol y el tipo de
gol

HU02- EQUIPOS DE FUTBOL


como: usuario
quiero: Registrar el nombre del equipo con su respectiva nacionalidad

para: Saber el país del que viene el equipo


condiciones
:
-almacenar todos los datos de los equipos con su país de origen.

HU03- ENTRENADOR DEL EQUIPO


como: usuario
quiero: El nombre y la nacionalidad del entrenador
para: Saber de qué país es y almacenar en la base de datos su nacionalidad
condiciones:
-lograr una comunicación con los jugadores

-que las entrevistas sean fluidas a la hora de hacer preguntas.


HU04- JUGADOR
como: usuario
quiero: Registrar su nacionalidad, la edad, nombre e ID jugador

para: Llevar un registro claro de sus datos


condiciones
:
-tener almacenados estos datos en el sistema

-para saber que jugador fue el que realizo el gol, el minuto en el que lo iso y la hora.

HU05- REGISTRO DE PARTIDOS


como: usuario
Registro de los partidos con la fecha, la hora, el tipo de partido, saber que equipos participan y en que liga, tipo
quiero: de participación por equipo

para: Tener toda la información que necesito de los partidos jugados


condiciones
:
-Tener una vista de todos los datos y registros de cada partido

-almacenar todos estos datos en tablas de clasificación con el ID de los jugadores que jugaron el entrenador, las sanciones, los
goles, los equipos que clasifican, la liga en que están, el grupo, el árbitro y el tipo de árbitro.

HU06- ARBITRO
como: usuario
quiero: Registro del árbitro que dirigió el partido más su nacionalidad y nombre

para: Llevar un registro de las sanciones hacia los jugadores


condiciones
:
-almacenar todas las sanciones

-llevar un conteo de las faltas y los goles realizados en el partido disputado.


HU07- REGISTRO DE EQUIPOS CLASIFICADOS
como: usuario
Tener registro de todos los equipos que están clasificados con sus respectivos entrenadores y el grupo en el que
quiero: se encuentran.

para: Llevar un registro de los equipos clasificados


condiciones
:
-almacenar cual es el equipo que esta clasificando y cual queda descalificado

-mantener un registro de los clasificados para saber si pasan a la siguiente fase con la ID del entrenador, ID de los jugadores, el
árbitro del encuentro las sanciones y el código de la anotación.

HU08- REGISTRO DE SANCIONES


como: usuario
Se requiere que en el registro de sanciones aparezca con su respectivo jugador, el partido, minuto de la sanción y
quiero: el tipo de sanción recibida

para: Saber que jugador esta sancionado y el tipo de falta que realizo dicho jugador.
condiciones
:
-tener un registro almacenado con todas las faltas con el ID del jugador el arbitro que anoto la falta, el minuto de la sanción, el
partido y el tipo de sanción.
NORMALIZACION DE TABLAS

REGISTRO DE PARTIDOS JUGADOS (ID_jugadores, ID_entrenador, cod_sancion, cod_anotacion, cod_equipo,


código_liga, ID_arbitro)

1FN

Partidos (cod_partido, código_equipo, código_liga, ID_entrenador, ID_jugadores, ID_arbitro)

Perdedor (cod_equipo_f, ID_jugador, ID_entrenador)

Ganador (código_equipo_c, ID_jugador, ID_entrenador, código_liga, cod_equipo, cod_anotacion)

2FN

(cod_partido, cod_equipo_f, cod_equipo_c)

REGISTRO DE GOLES (partido, liga, equipo, jugadores, minuto de gol, tipo de gol)

1FN

Liga (código_liga, nombre_de_liga, fecha_liga, grupo)

Jugador (ID_jugador, nombre_jugador, nacionalidad)

Entrenador (ID_entrenador, nacionalidad_entrenador, nombre_entrenador)

Equipo (cod_equipo, nombre_equipo, país_equipo)

Min-gol (cod_anotacion, minuto_del_gol, tipo_de_gol, cantidad de goles)

2FN

Anotación (cod_equipo, ID_jugador, cod_anotacion)

Jugador (ID_jugador, cod_anotacion, cod_liga, cod_equipo, ID_entrenador)


3FN (cod_anotacion, ID_jugador, ID_entrenador)

REGISTRO DE SANCIONES (ID_jugador, ID_arbitro, min-sancion-partido, tipo de sanción)

1FN

Arbitro (ID_arbitro, nombre_arbitro, nacionalidad_arbitro, tipo_de_arbitro)

Sanción (cod_sancion, tipo_de_sancion, min_sancion)

Partido (cod_partido, final, eliminatoria, visita, local, alargue)

2FN

Arbitro (ID_arbitro, cod_partido)

Sanción (cod_sancion, ID_arbitro)

3FN

(cod_sancion, ID_arbitro)

EQUIPOS CLASIFICADOS (ID_entrenador, ID_jugador, ID_arbitro, cod_sancion, cod_anotacion, cod_equipo)

1FN

Equipo clasificado (cod_equipo_c, cod_anotacion, ID_jugador, ID_entrenador, ID_arbitro)

Equipo desclasificado (cod_equipo_f, ID_jugador, ID_entrenador)

2FN

(cod_equipo_c, cod_equipo_f)
MODELO LOGICO ERD

MODELO TABLAS RELACIONAL


TABLAS DE SQL SERVER

if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')

where r.fkeyid = object_id('ENTRENADOR') and o.name = 'FK_ENTRENAD_ENTRENA2_EQUIPO')

alter table ENTRENADOR

drop constraint FK_ENTRENAD_ENTRENA2_EQUIPO

go

if exists (select 1

from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')

where r.fkeyid = object_id('EQUIPO') and o.name = 'FK_EQUIPO_ENTRENA3_ENTRENAD')

alter table EQUIPO

drop constraint FK_EQUIPO_ENTRENA3_ENTRENAD

go

if exists (select 1

from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')

where r.fkeyid = object_id('JUGADOR') and o.name = 'FK_JUGADOR_DIRIGE_ENTRENAD')

alter table JUGADOR

drop constraint FK_JUGADOR_DIRIGE_ENTRENAD

go

if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')

where r.fkeyid = object_id('JUGADOR') and o.name = 'FK_JUGADOR_PERTENECE_EQUIPO')

alter table JUGADOR

drop constraint FK_JUGADOR_PERTENECE_EQUIPO

go

if exists (select 1

from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')

where r.fkeyid = object_id('JUGADOR') and o.name = 'FK_JUGADOR_TIENE_REGISTRO')

alter table JUGADOR

drop constraint FK_JUGADOR_TIENE_REGISTRO

go

if exists (select 1

from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')

where r.fkeyid = object_id('PARTIDO') and o.name = 'FK_PARTIDO_PRESIDIR_ARBITRO')

alter table PARTIDO

drop constraint FK_PARTIDO_PRESIDIR_ARBITRO

go

if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')

where r.fkeyid = object_id('REGISTRO_DE_GOLES') and o.name = 'FK_REGISTRO_ANOTA_EQUIPO')

alter table REGISTRO_DE_GOLES

drop constraint FK_REGISTRO_ANOTA_EQUIPO

go

if exists (select 1

from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')

where r.fkeyid = object_id('REGISTRO_DE_GOLES') and o.name = 'FK_REGISTRO_ARTAS_ANOTACIO')

alter table REGISTRO_DE_GOLES

drop constraint FK_REGISTRO_ARTAS_ANOTACIO

go

if exists (select 1

from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')

where r.fkeyid = object_id('REGISTRO_DE_GOLES') and o.name = 'FK_REGISTRO_HAY_PARTIDO')

alter table REGISTRO_DE_GOLES

drop constraint FK_REGISTRO_HAY_PARTIDO

go

if exists (select 1
from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')

where r.fkeyid = object_id('SANCION') and o.name = 'FK_SANCION_ANOTAN_ARBITRO')

alter table SANCION

drop constraint FK_SANCION_ANOTAN_ARBITRO

go

if exists (select 1

from sysobjects

where id = object_id('ANOTACIONES')

and type = 'U')

drop table ANOTACIONES

go

if exists (select 1

from sysobjects

where id = object_id('ARBITRO')

and type = 'U')

drop table ARBITRO

go

if exists (select 1
from sysindexes

where id = object_id('ENTRENADOR')

and name = 'ENTRENA2_FK'

and indid > 0

and indid < 255)

drop index ENTRENADOR.ENTRENA2_FK

go

if exists (select 1

from sysobjects

where id = object_id('ENTRENADOR')

and type = 'U')

drop table ENTRENADOR

go

if exists (select 1

from sysindexes

where id = object_id('EQUIPO')

and name = 'ENTRENA3_FK'

and indid > 0

and indid < 255)


drop index EQUIPO.ENTRENA3_FK

go

if exists (select 1

from sysobjects

where id = object_id('EQUIPO')

and type = 'U')

drop table EQUIPO

go

if exists (select 1

from sysindexes

where id = object_id('JUGADOR')

and name = 'PERTENECE_FK'

and indid > 0

and indid < 255)

drop index JUGADOR.PERTENECE_FK

go

if exists (select 1

from sysindexes
where id = object_id('JUGADOR')

and name = 'DIRIGE_FK'

and indid > 0

and indid < 255)

drop index JUGADOR.DIRIGE_FK

go

if exists (select 1

from sysindexes

where id = object_id('JUGADOR')

and name = 'TIENE_FK'

and indid > 0

and indid < 255)

drop index JUGADOR.TIENE_FK

go

if exists (select 1

from sysobjects

where id = object_id('JUGADOR')

and type = 'U')

drop table JUGADOR


go

if exists (select 1

from sysindexes

where id = object_id('PARTIDO')

and name = 'PRESIDIR_FK'

and indid > 0

and indid < 255)

drop index PARTIDO.PRESIDIR_FK

go

if exists (select 1

from sysobjects

where id = object_id('PARTIDO')

and type = 'U')

drop table PARTIDO

go

if exists (select 1

from sysindexes

where id = object_id('REGISTRO_DE_GOLES')
and name = 'ARTAS_FK'

and indid > 0

and indid < 255)

drop index REGISTRO_DE_GOLES.ARTAS_FK

go

if exists (select 1

from sysindexes

where id = object_id('REGISTRO_DE_GOLES')

and name = 'ANOTA_FK'

and indid > 0

and indid < 255)

drop index REGISTRO_DE_GOLES.ANOTA_FK

go

if exists (select 1

from sysindexes

where id = object_id('REGISTRO_DE_GOLES')

and name = 'HAY_FK'

and indid > 0

and indid < 255)


drop index REGISTRO_DE_GOLES.HAY_FK

go

if exists (select 1

from sysobjects

where id = object_id('REGISTRO_DE_GOLES')

and type = 'U')

drop table REGISTRO_DE_GOLES

go

if exists (select 1

from sysindexes

where id = object_id('SANCION')

and name = 'ANOTAN_FK'

and indid > 0

and indid < 255)

drop index SANCION.ANOTAN_FK

go

if exists (select 1

from sysobjects
where id = object_id('SANCION')

and type = 'U')

drop table SANCION

go

/*==============================================================*/

/* Table: ANOTACIONES */

/*==============================================================*/

create table ANOTACIONES (

COD_ANOTACION int not null,

MINUTO_DEL_GOL datetime null,

TIPO_DE_GOL char(10) null,

CANTIDAD_DE_GOLES int null,

constraint PK_ANOTACIONES primary key nonclustered (COD_ANOTACION)

go

/*==============================================================*/

/* Table: ARBITRO */

/*==============================================================*/

create table ARBITRO (


ID_ARBITRO int not null,

NOMBRE_ARBITRO char(20) null,

NACIONALIDAD char(10) null,

TIPO_ARBITRO char(15) null,

constraint PK_ARBITRO primary key nonclustered (ID_ARBITRO)

go

/*==============================================================*/

/* Table: ENTRENADOR */

/*==============================================================*/

create table ENTRENADOR (

COD_ENTRENADOR int not null,

COD_EQUIPO int null,

NACIONALIDAD_ENTRENADOR char(10) null,

NOMBRE_ENTRENADOR char(20) null,

constraint PK_ENTRENADOR primary key nonclustered (COD_ENTRENADOR)

go

/*==============================================================*/
/* Index: ENTRENA2_FK */

/*==============================================================*/

create index ENTRENA2_FK on ENTRENADOR (

COD_EQUIPO ASC

go

/*==============================================================*/

/* Table: EQUIPO */

/*==============================================================*/

create table EQUIPO (

COD_EQUIPO int not null,

COD_ENTRENADOR int null,

NOMBRE_EQUIPO char(10) null,

PAIS_EQUIPO char(10) null,

constraint PK_EQUIPO primary key nonclustered (COD_EQUIPO)

go

/*==============================================================*/

/* Index: ENTRENA3_FK */
/*==============================================================*/

create index ENTRENA3_FK on EQUIPO (

COD_ENTRENADOR ASC

go

/*==============================================================*/

/* Table: JUGADOR */

/*==============================================================*/

create table JUGADOR (

ID_JUGADOR int not null,

CODIGO_LIGA int null,

COD_ENTRENADOR int null,

COD_EQUIPO int null,

NACIONALIDAD char(10) null,

NOMBRE_JUGADOR char(20) null,

constraint PK_JUGADOR primary key nonclustered (ID_JUGADOR)

go

/*==============================================================*/
/* Index: TIENE_FK */

/*==============================================================*/

create index TIENE_FK on JUGADOR (

CODIGO_LIGA ASC

go

/*==============================================================*/

/* Index: DIRIGE_FK */

/*==============================================================*/

create index DIRIGE_FK on JUGADOR (

COD_ENTRENADOR ASC

go

/*==============================================================*/

/* Index: PERTENECE_FK */

/*==============================================================*/

create index PERTENECE_FK on JUGADOR (

COD_EQUIPO ASC

)
go

/*==============================================================*/

/* Table: PARTIDO */

/*==============================================================*/

create table PARTIDO (

COD_PARTIDO int not null,

ID_ARBITRO int null,

FINAL bit null,

ELIMINATORIA bit null,

VISITA bit null,

LOCAL bit null,

constraint PK_PARTIDO primary key nonclustered (COD_PARTIDO)

go

/*==============================================================*/

/* Index: PRESIDIR_FK */

/*==============================================================*/

create index PRESIDIR_FK on PARTIDO (

ID_ARBITRO ASC
)

go

/*==============================================================*/

/* Table: REGISTRO_DE_GOLES */

/*==============================================================*/

create table REGISTRO_DE_GOLES (

CODIGO_LIGA int not null,

COD_PARTIDO int null,

COD_ANOTACION int null,

COD_EQUIPO int null,

NOMBRE_DE_LIGA char(20) null,

GRUPO char(5) null,

FECHA datetime null,

constraint PK_REGISTRO_DE_GOLES primary key nonclustered (CODIGO_LIGA)

go

/*==============================================================*/

/* Index: HAY_FK */

/*==============================================================*/
create index HAY_FK on REGISTRO_DE_GOLES (

COD_PARTIDO ASC

go

/*==============================================================*/

/* Index: ANOTA_FK */

/*==============================================================*/

create index ANOTA_FK on REGISTRO_DE_GOLES (

COD_EQUIPO ASC

go

/*==============================================================*/

/* Index: ARTAS_FK */

/*==============================================================*/

create index ARTAS_FK on REGISTRO_DE_GOLES (

COD_ANOTACION ASC

go
/*==============================================================*/

/* Table: SANCION */

/*==============================================================*/

create table SANCION (

COD_SANCION int not null,

ID_ARBITRO int null,

TIPO_DE_SANCION char(10) null,

MIN_SANCION datetime null,

constraint PK_SANCION primary key nonclustered (COD_SANCION)

go

/*==============================================================*/

/* Index: ANOTAN_FK */

/*==============================================================*/

create index ANOTAN_FK on SANCION (

ID_ARBITRO ASC

go

alter table ENTRENADOR


add constraint FK_ENTRENAD_ENTRENA2_EQUIPO foreign key (COD_EQUIPO)

references EQUIPO (COD_EQUIPO)

go

alter table EQUIPO

add constraint FK_EQUIPO_ENTRENA3_ENTRENAD foreign key (COD_ENTRENADOR)

references ENTRENADOR (COD_ENTRENADOR)

go

alter table JUGADOR

add constraint FK_JUGADOR_DIRIGE_ENTRENAD foreign key (COD_ENTRENADOR)

references ENTRENADOR (COD_ENTRENADOR)

go

alter table JUGADOR

add constraint FK_JUGADOR_PERTENECE_EQUIPO foreign key (COD_EQUIPO)

references EQUIPO (COD_EQUIPO)

go

alter table JUGADOR

add constraint FK_JUGADOR_TIENE_REGISTRO foreign key (CODIGO_LIGA)


references REGISTRO_DE_GOLES (CODIGO_LIGA)

go

alter table PARTIDO

add constraint FK_PARTIDO_PRESIDIR_ARBITRO foreign key (ID_ARBITRO)

references ARBITRO (ID_ARBITRO)

go

alter table REGISTRO_DE_GOLES

add constraint FK_REGISTRO_ANOTA_EQUIPO foreign key (COD_EQUIPO)

references EQUIPO (COD_EQUIPO)

go

alter table REGISTRO_DE_GOLES

add constraint FK_REGISTRO_ARTAS_ANOTACIO foreign key (COD_ANOTACION)

references ANOTACIONES (COD_ANOTACION)

go

alter table REGISTRO_DE_GOLES

add constraint FK_REGISTRO_HAY_PARTIDO foreign key (COD_PARTIDO)

references PARTIDO (COD_PARTIDO)


go

alter table SANCION

add constraint FK_SANCION_ANOTAN_ARBITRO foreign key (ID_ARBITRO)

references ARBITRO (ID_ARBITRO)

go

Conclusión

Fue una prueba que me ayudo a poner a prueba mis conocimientos y poner en practica todo lo explicado en clases.
Referencias, Bibliográficas o Linkografía

http://blogdelosuno.blogspot.com/

También podría gustarte