Вы находитесь на странице: 1из 5

/* Crear la Base de Datos Recreaci�n */

USE MASTER
GO
/****** Object: Database [RECREACION] ******/
IF NOT EXISTS (SELECT name FROM sys.databases WHERE name =N'RECREACION')
BEGIN
CREATE DATABASE RECREACION
END
go
/* Poner en uso la Base de Datos */
use RECREACION

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'))
BEGIN
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);
END
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'))
BEGIN
CREATE TABLE Tipo(
CodTipo Int IDENTITY(1,1) PRIMARY KEY,
NomTipo varchar(30)NOT NULL);
END
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'))
BEGIN
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);

END
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'))
BEGIN
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);
END
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'))
BEGIN
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,FotoPar image);
END
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'))
BEGIN
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);
END
GO
/* Datos para la tabla Institucion */
INSERT INTO Institucion(NomIns,DirIns,TelIns) VALUES('Prodeportes','Cra 3Nro 4-
24','8701020');
INSERT INTO Institucion(NomIns,DirIns,TelIns) VALUES('La Esperanza','Cra 10Nro 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 laCultura','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
lacanci�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/15/2012','04/17/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);
INSERT INTO Institucion_Evento(CodEve,CodIns) Values(5,2);
INSERT INTO Institucion_Evento(CodEve,CodIns) Values(5,1);
GO
/* Datos para la tabla Participante*/
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)
VALUES('Andres','Nieto Alvarez','83232390',33);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)
VALUES('Juan','Castro Nieto','83232392',28);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)
VALUES('Lunio','Casta�eda Silva','80232393',35);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)
VALUES('Pedro','Nieto Alvarez','81232190',24);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)
VALUES('Daniel','Guzman Ortiz','84232397',27);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)
VALUES('Lino','Castro Ordo�ez','82232391',24);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)
VALUES('Hernando','Moncaleano Vargas','83232244',22);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)
VALUES('Pablo','Henriquez Villa','81232396',26);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)
VALUES('Andres','Pe�a Silva','83234397',27);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)
VALUES('Adan','Perez Alvarez','83232333',29);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)
VALUES('Sergio','Nieto Vargas','84234394',31);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar) VALUES('Jose Miguel','Llanos
Mosquera','83233398',33);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)
VALUES('Javier','Pinto Ortiz','82222390',20);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)
VALUES('Pedro','Castro Nieto','83232399',25);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)
VALUES('Manolo','Cardona Prieto','83232380',23);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)
VALUES('Luis','Carvajal Silva','83232395',33);
INSERT INTO Participante(NomPar,ApePar,IdPar,EdadPar)
VALUES('Jairo','Osorio Castro','84232390',37);
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);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(2,14,5000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(2,15,5000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(3,16,6000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(3,17,6000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(3,18,6000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(3,19,6000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(3,20,6000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(3,21,6000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(3,22,6000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(3,23,6000);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(4,24,4500);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(4,25,4500);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(4,26,4500);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(4,27,4500);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(4,28,4500);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(4,29,4500);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(5,30,5500);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(5,12,5500);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(5,11,5500);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(5,10,5500);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(5,9,5500);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(5,7,5500);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(5,6,6500);
INSERT INTO Participante_Evento(CodEve,CodPar,ValIns) VALUES(5,5,6500);
GO

Вам также может понравиться