Está en la página 1de 4

/****** CREAR BASE DE DATOS SECRETARIA DEPORTE, RECREACION Y CULTURA

******/
USE MASTER
GO
IF NOT EXISTS (SELECT name FROM sys.databases WHERE name =N'SecDEPORTE')
BEGIN
CREATE DATABASE SecDEPORTE
END
go
/* Poner en uso la Base de Datos SecDEPORTE */
use SecDEPORTE
go
/* Crear la Tabla Institución*/
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[Institucion]') AND type in (N'U'))
CREATE TABLE Institucion(
CodIns Int IDENTITY(1,1) PRIMARY KEY,
NomIns varchar(30) NOT NULL,
DirIns varchar(30) NOT NULL,
TelIns varchar(15) NOT NULL);
GO
/* Crear la Tabla Tipo */
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[Tipo]') AND type in (N'U'))
CREATE TABLE Tipo(
CodTipo Int IDENTITY(1,1) PRIMARY KEY,
NomTipo varchar(30)NOT NULL);
GO
/* Crear la Tabla Evento */
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[Evento]') AND type in (N'U'))
CREATE TABLE Evento(
CodEve Int IDENTITY(1,1) PRIMARY KEY,
NomEve varchar(60) NOT NULL,
CodTipo Int REFERENCES Tipo(CodTipo) NOT NULL,
FechIni Datetime NOT NULL,
FechFin Datetime NOT NULL);
GO
/* Crear la Tabla Institucion_Evento */
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[Institucion_Evento]') AND type in (N'U'))
CREATE TABLE Institucion_Evento(
CodSec Int IDENTITY(1,1) PRIMARY KEY,
CodEve Int REFERENCES Evento(CodEve) NOT NULL,
CodIns Int REFERENCES Institucion(CodIns) NOT NULL);
go
/* Crear la Tabla Participante */
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[Participante]') AND type in (N'U'))
CREATE TABLE Participante(
CodPar Int IDENTITY(1,1) PRIMARY KEY,
NomPar varchar(30) NOT NULL,
ApePar varchar(30) NOT NULL,
IdPar varchar(30) NOT NULL,
EdadPar smallint NOT NULL);
GO
/* Crear la Tabla Participante_Evento */
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id =
OBJECT_ID(N'[dbo].[Participante_Evento]') AND type in (N'U'))
CREATE TABLE Participante_Evento(
CodSec Int IDENTITY(1,1) PRIMARY KEY,
CodEve Int REFERENCES Evento(CodEve) NOT NULL,
CodPar Int REFERENCES Participante(CodPar) NOT NULL,
ValIns money);
GO
/* Datos para la tabla Institucion */
INSERT INTO Institucion(NomIns,DirIns,TelIns) VALUES('Prodeportes','Cra 3 Nro 4-
24','8701020');
INSERT INTO Institucion(NomIns,DirIns,TelIns) VALUES('La Esperanza','Cra 10 Nro 20-
11','8721024');
INSERT INTO Institucion(NomIns,DirIns,TelIns) VALUES('Unidos por la Paz','Cra 6 Nro
7-24','8731028');
INSERT INTO Institucion(NomIns,DirIns,TelIns) VALUES('Las Estrellas','Cra 3 Nro 9-
24','8761040');
INSERT INTO Institucion(NomIns,DirIns,TelIns) VALUES('La Catleya','Cra 3 Nro 5-
27','8751220');
INSERT INTO Institucion(NomIns,DirIns,TelIns) VALUES('La Nueva Ola','Cra 3 Nro 6-
24','8741044');
INSERT INTO Institucion(NomIns,DirIns,TelIns) VALUES('Salva una Vida','Cra 3 Nro 7-
24','8731121');
INSERT INTO Institucion(NomIns,DirIns,TelIns) VALUES('Recreando','Cra 3 Nro 2-
44','8741522');
INSERT INTO Institucion(NomIns,DirIns,TelIns) VALUES('Unidos por la Cultura','Cra 2
Nro 2-22','8761623');
GO
/*Datos para la tabla Tipo */
INSERT INTO Tipo(NomTipo) VALUES('Deporte Terrestre');
INSERT INTO Tipo(NomTipo) VALUES('Deporte Acuático');
INSERT INTO Tipo(NomTipo) VALUES('Deporte Aéreo');
INSERT INTO Tipo(NomTipo) VALUES('Deporte Extremo');
INSERT INTO Tipo(NomTipo) VALUES('Arte Contemporaneo');
INSERT INTO Tipo(NomTipo) VALUES('Arte Rupestre');
INSERT INTO Tipo(NomTipo) VALUES('Arte Moderno');
INSERT INTO Tipo(NomTipo) VALUES('Música');
INSERT INTO Tipo(NomTipo) VALUES('Peña Cultural');
GO
/* Datos para la tabla Evento */
INSERT INTO Evento(NomEve,CodTipo,FechIni,FechFin) VALUES('Festival de la
canción',9,'01/01/2012','02/01/2012');
INSERT INTO Evento(NomEve,CodTipo,FechIni,FechFin) VALUES('Zonal de
Fútbol',1,'02/02/2012','02/03/2012');
INSERT INTO Evento(NomEve,CodTipo,FechIni,FechFin) VALUES('Exposición de
Pintura',5,'04/03/2012','11/03/2012');
INSERT INTO Evento(NomEve,CodTipo,FechIni,FechFin) VALUES('Encuentro de habilidades
artísticas',9,'11/04/2012','11/04/2012');
INSERT INTO Evento(NomEve,CodTipo,FechIni,FechFin) VALUES('Concurso de
Rafting',4,'04/1/2012','04/7/2012');
GO
/* Datos para la tabla Institucion_Evento*/
INSERT INTO Institucion_Evento(CodEve,CodIns) Values(1,2);
INSERT INTO Institucion_Evento(CodEve,CodIns) Values(1,3);
INSERT INTO Institucion_Evento(CodEve,CodIns) Values(1,5);
INSERT INTO Institucion_Evento(CodEve,CodIns) Values(2,4);
INSERT INTO Institucion_Evento(CodEve,CodIns) Values(2,6);
INSERT INTO Institucion_Evento(CodEve,CodIns) Values(2,3);
INSERT INTO Institucion_Evento(CodEve,CodIns) Values(3,3);
INSERT INTO Institucion_Evento(CodEve,CodIns) Values(3,3);
INSERT INTO Institucion_Evento(CodEve,CodIns) Values(3,3);
INSERT INTO Institucion_Evento(CodEve,CodIns) Values(4,3);
INSERT INTO Institucion_Evento(CodEve,CodIns) Values(4,5);
INSERT INTO Institucion_Evento(CodEve,CodIns) Values(4,1);
GO
/* Datos para la tabla Participante*/

INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)VALUES('Leandro','Quintero


Narvaez','83232330',35);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)VALUES('Marcos','Dussan
Alvarez','87237390',31);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)VALUES('Diego','Polanco
Vargas','88232398',30);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar) VALUES('Julio','Neira
Castro','82232290',24);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)VALUES('Manuel','Silva
Castro','84235390',21);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)VALUES('Rafael','Mendieta
Alvarez','83237397',20);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)VALUES('Guillermo','Cano
Soto','81232391',19);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)VALUES('Pastor','Luna
Ortiz','87238399',22);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)VALUES('James','Claros
Alvarez','81231391',21);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)VALUES('Carlos','Alvarado
Silva','84234395',23);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)VALUES('Hernan','Rojas
Alvarez','86236396',23);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)VALUES('Jose','Martinez
Rojas','84242390',34);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)VALUES('Miguel','Silva
Castro','88232390',35);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)VALUES('Nelson','Gongora
Muñoz','87237397',37);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)VALUES('Fermín','Beltran
Barragan','81232191',39);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)VALUES('Francisco','Guarín
Rojas','89239399',40);
GO
/* Datos para la tabla Participante_Evento*/
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(1,1,3000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(1,2,3000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(1,3,3000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(1,4,3000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(1,5,3000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(1,6,3000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(1,7,3000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(1,8,3000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(2,9,5000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(2,10,5000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(2,11,5000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(2,12,5000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(2,13,5000);
GO

También podría gustarte