Está en la página 1de 5

Código BD 01

DESARROLLO DE BASES DE DATOS


Versión 01
PARCIAL 3
Fecha 2023-04-26

Profesor: Gustavo Macias Suarez

Estudiante: __________________________________

Objetivo: Indagar el nivel de apropiación que están adquiriendo los estudiantes del curso de desarrollo
en bases de datos, desde las concepciones abordadas en la unidad 2, 3 y 4, Relación de tablas,
funciones (escalares y de tabla), Procedimientos almacenados.
Tipo de actividad (Parcial y Taller): Esta actividad hace parte del plan evaluativo de aprendizaje
(20%).

Actividad No. 1 – Desarrollar Funciones y procedimientos almacenados (60%)


Con la base de datos enviada “Alcaldia” con el parcial desarrollar la actividad 1.

a. Crear la siguiente función de tabla con su segundo apellido (20%)

-- MOSTRAR EL NOMBRE COMPLETO DE LA PERSONA (NOMBRE+APELLIDO), FECHA DE NACIMIENTO,


SU EDAD, SEXO, NOMBRE DEL BARRIO, DIRECCION DEL PREDIO, MATRICULA, ESTRATO, VALOR
DEL PAGO Y SU TOTAL PAGAR.

b. Crear la siguiente función escalar de mayúsculas con nombre de nombre 1 y el apellido 1 (20%)

-- MOSTRAR EL NOMBRE DE LA COMUNA Y EL NOMBRE DEL BARRIO, DE FORMA QUE APAREZCA EN


MAYUSCULAS AMBOS.

c. Crear el siguiente procedimiento almacenado (20%).

-- CREAR UN TABLA ADICIONAL CON LA SIGUIENTE INFORMACIÓN: GUARDAR UN TOP 3.500 DE EL


NOMBRE DE LA PERSONA, SU APELLIDO CONCATENADO (NOMBRE+APELLIDO), EL NOMBRE DEL BARRIO,
VALOR DE LA CUENTA POR COBRAR, EL PREDIO CON SU ESTRATO, NOMBRE TIPO DE USO, CALCULAR EL
TOTAL DE FACTURA VIGENTE CON LA RESTA DE TOTAL PAGAR MENOS TOTAL.

Actividad No. 2 – Desarrollar un Diagrama Relacional (40%)


Crear las tablas a continuación, terminándolas e incluir la clave primaria como tipo INT y las claves
foráneas, e insertar posteriormente los datos.
Código BD 01
DESARROLLO DE BASES DE DATOS
Versión 01
PARCIAL 3
Fecha 2023-04-26

CREATE TABLE [dbo].[Electores](

[Cedula] [int] NOT NULL,

[Nombre] [nvarchar](255) NULL,

[Edad] [int] NULL,

[Nit_Partido_Politico] [int] NULL,

[Nit_Institucion] [int] NULL,

[Numero_Mesa] [int] NULL);

CREATE TABLE [dbo].[Jurados](

[Cedula] [int] NOT NULL,

[Nombre] [nvarchar](255) NULL,

[Edad] [int] NULL,

[NitInstitucion] [int] NULL,

[NumeroMesa] [int] NULL,

[TipoJurado] [int] NULL);

CREATE TABLE [dbo].[MesaVotaciones](

[COD_MESAS] [int] NOT NULL,


Código BD 01
DESARROLLO DE BASES DE DATOS
Versión 01
PARCIAL 3
Fecha 2023-04-26

[NumeroMesa] [int] NULL,

[NitInstitucion] [int] NULL,

[COD_REGISTRO] [int] NULL);

CREATE TABLE [dbo].[Registros](

[COD_REGISTRO] [int] NOT NULL,

[VOTOS_BUENOS] [int] NULL,

[VOTOS_BLANCOS] [int] NULL,

[VOTOS_NULOS] [int] NULL);

CREATE TABLE [dbo].[TipoJurado](

[ID_TIPO_JURADO] [int] NOT NULL,

[DESCRIPCION] [nvarchar](255) NULL);

INSERT [dbo].[Electores] ([Cedula], [Nombre], [Edad], [Nit_Partido_Politico], [Nit_Institucion], [Numero_Mesa]) VALUES (7117123,
N'ANDREA DEL PILAR GUZMAN ROJAS', 37, 86040485, 900546178, 1)

INSERT [dbo].[Electores] ([Cedula], [Nombre], [Edad], [Nit_Partido_Politico], [Nit_Institucion], [Numero_Mesa]) VALUES (7117124,
N'ANDREA PAOLA GUTIERREZ ROMERO', 49, 90075464, 900546179, 2)

INSERT [dbo].[Electores] ([Cedula], [Nombre], [Edad], [Nit_Partido_Politico], [Nit_Institucion], [Numero_Mesa]) VALUES (7117125,
N'ANDREA LILIANA SAMPER MARTINEZ', 31, 83012485, 900546180, 3)

INSERT [dbo].[Electores] ([Cedula], [Nombre], [Edad], [Nit_Partido_Politico], [Nit_Institucion], [Numero_Mesa]) VALUES (7117126,
N'ANDREA MARCELA BARRAGAN GARCIA', 35, 83012437, 900546181, 4)

INSERT [dbo].[Electores] ([Cedula], [Nombre], [Edad], [Nit_Partido_Politico], [Nit_Institucion], [Numero_Mesa]) VALUES (7117127,
N'ANDREA YOHANNA PINZON YEPES', 46, 90108335, 900546182, 5)

INSERT [dbo].[Electores] ([Cedula], [Nombre], [Edad], [Nit_Partido_Politico], [Nit_Institucion], [Numero_Mesa]) VALUES (7117128,
N'AMELIA PEREZ TABARES', 27, 86040485, 900546183, 6)

INSERT [dbo].[Electores] ([Cedula], [Nombre], [Edad], [Nit_Partido_Politico], [Nit_Institucion], [Numero_Mesa]) VALUES (7117129,
N'ALEJANDRA MARIA AGUDELO SUAREZ', 30, 90075464, 900546184, 7)

INSERT [dbo].[Electores] ([Cedula], [Nombre], [Edad], [Nit_Partido_Politico], [Nit_Institucion], [Numero_Mesa]) VALUES (7117130,
N'ALVARO CALDERON ARTUNDUAGA', 35, 83012485, 900546185, 8)

INSERT [dbo].[Electores] ([Cedula], [Nombre], [Edad], [Nit_Partido_Politico], [Nit_Institucion], [Numero_Mesa]) VALUES (7117131,
N'AYDA CATALINA PULIDO CHAPARRO', 33, 83012437, 900546186, 9)

INSERT [dbo].[Electores] ([Cedula], [Nombre], [Edad], [Nit_Partido_Politico], [Nit_Institucion], [Numero_Mesa]) VALUES (7117132,
N'BERTHA XIMENA PATRICIA BARBOSA TORRES', 50, 90108335, 900546187, 10)

INSERT [dbo].[Jurados] ([Cedula], [Nombre], [Edad], [NitInstitucion], [NumeroMesa], [TipoJurado]) VALUES (43250749, N'ANDREA DEL
PILAR GUZMAN ROJAS', 37, 900123543, 1, 1)
Código BD 01
DESARROLLO DE BASES DE DATOS
Versión 01
PARCIAL 3
Fecha 2023-04-26

INSERT [dbo].[Jurados] ([Cedula], [Nombre], [Edad], [NitInstitucion], [NumeroMesa], [TipoJurado]) VALUES (43250750, N'ANDREA
PAOLA GUTIERREZ ROMERO', 49, 900123544, 2, 1)

INSERT [dbo].[Jurados] ([Cedula], [Nombre], [Edad], [NitInstitucion], [NumeroMesa], [TipoJurado]) VALUES (43250751, N'ANDREA
LILIANA SAMPER MARTINEZ', 31, 900123545, 3, 1)

INSERT [dbo].[Jurados] ([Cedula], [Nombre], [Edad], [NitInstitucion], [NumeroMesa], [TipoJurado]) VALUES (43250752, N'ANDREA
MARCELA BARRAGAN GARCIA', 35, 900123546, 4, 1)

INSERT [dbo].[Jurados] ([Cedula], [Nombre], [Edad], [NitInstitucion], [NumeroMesa], [TipoJurado]) VALUES (43250753, N'ANDREA
YOHANNA PINZON YEPES', 46, 900123547, 5, 1)

INSERT [dbo].[Jurados] ([Cedula], [Nombre], [Edad], [NitInstitucion], [NumeroMesa], [TipoJurado]) VALUES (43250754, N'AMELIA PEREZ
TABARES', 27, 900123548, 6, 1)

INSERT [dbo].[Jurados] ([Cedula], [Nombre], [Edad], [NitInstitucion], [NumeroMesa], [TipoJurado]) VALUES (43250755, N'ALEJANDRA
MARIA AGUDELO SUAREZ', 30, 900123549, 7, 1)

INSERT [dbo].[Jurados] ([Cedula], [Nombre], [Edad], [NitInstitucion], [NumeroMesa], [TipoJurado]) VALUES (43250756, N'ALVARO
CALDERON ARTUNDUAGA', 35, 900123550, 8, 1)

INSERT [dbo].[Jurados] ([Cedula], [Nombre], [Edad], [NitInstitucion], [NumeroMesa], [TipoJurado]) VALUES (43250757, N'AYDA
CATALINA PULIDO CHAPARRO', 33, 900123551, 9, 1)

INSERT [dbo].[Jurados] ([Cedula], [Nombre], [Edad], [NitInstitucion], [NumeroMesa], [TipoJurado]) VALUES (43250758, N'BERTHA
XIMENA PATRICIA BARBOSA TORRES', 50, 900

INSERT [dbo].[MesaVotaciones] ([COD_MESAS], [NumeroMesa], [NitInstitucion], [COD_REGISTRO]) VALUES (1, 1, 900546178, 1)

INSERT [dbo].[MesaVotaciones] ([COD_MESAS], [NumeroMesa], [NitInstitucion], [COD_REGISTRO]) VALUES (2, 1, 900546179, 2)

INSERT [dbo].[MesaVotaciones] ([COD_MESAS], [NumeroMesa], [NitInstitucion], [COD_REGISTRO]) VALUES (3, 1, 900546180, 3)

INSERT [dbo].[MesaVotaciones] ([COD_MESAS], [NumeroMesa], [NitInstitucion], [COD_REGISTRO]) VALUES (4, 1, 900546181, 4)

INSERT [dbo].[MesaVotaciones] ([COD_MESAS], [NumeroMesa], [NitInstitucion], [COD_REGISTRO]) VALUES (5, 1, 900546182, 5)

INSERT [dbo].[MesaVotaciones] ([COD_MESAS], [NumeroMesa], [NitInstitucion], [COD_REGISTRO]) VALUES (6, 1, 900546183, 6)

INSERT [dbo].[MesaVotaciones] ([COD_MESAS], [NumeroMesa], [NitInstitucion], [COD_REGISTRO]) VALUES (7, 1, 900546184, 7)

INSERT [dbo].[MesaVotaciones] ([COD_MESAS], [NumeroMesa], [NitInstitucion], [COD_REGISTRO]) VALUES (8, 1, 900546185, 8)

INSERT [dbo].[MesaVotaciones] ([COD_MESAS], [NumeroMesa], [NitInstitucion], [COD_REGISTRO]) VALUES (9, 1, 900546186, 9)

INSERT [dbo].[MesaVotaciones] ([COD_MESAS], [NumeroMesa], [NitInstitucion], [COD_REGISTRO]) VALUES (10, 1, 900546187, 10)

INSERT [dbo].[Registros] ([COD_REGISTRO], [VOTOS_BUENOS], [VOTOS_BLANCOS], [VOTOS_NULOS]) VALUES (1, 89, 45, 20)

INSERT [dbo].[Registros] ([COD_REGISTRO], [VOTOS_BUENOS], [VOTOS_BLANCOS], [VOTOS_NULOS]) VALUES (2, 80, 49, 29)

INSERT [dbo].[Registros] ([COD_REGISTRO], [VOTOS_BUENOS], [VOTOS_BLANCOS], [VOTOS_NULOS]) VALUES (3, 88, 52, 37)

INSERT [dbo].[Registros] ([COD_REGISTRO], [VOTOS_BUENOS], [VOTOS_BLANCOS], [VOTOS_NULOS]) VALUES (4, 91, 44, 23)

INSERT [dbo].[Registros] ([COD_REGISTRO], [VOTOS_BUENOS], [VOTOS_BLANCOS], [VOTOS_NULOS]) VALUES (5, 91, 49, 35)

INSERT [dbo].[Registros] ([COD_REGISTRO], [VOTOS_BUENOS], [VOTOS_BLANCOS], [VOTOS_NULOS]) VALUES (6, 96, 56, 22)

INSERT [dbo].[Registros] ([COD_REGISTRO], [VOTOS_BUENOS], [VOTOS_BLANCOS], [VOTOS_NULOS]) VALUES (7, 83, 41, 34)

INSERT [dbo].[Registros] ([COD_REGISTRO], [VOTOS_BUENOS], [VOTOS_BLANCOS], [VOTOS_NULOS]) VALUES (8, 85, 49, 37)
Código BD 01
DESARROLLO DE BASES DE DATOS
Versión 01
PARCIAL 3
Fecha 2023-04-26

INSERT [dbo].[Registros] ([COD_REGISTRO], [VOTOS_BUENOS], [VOTOS_BLANCOS], [VOTOS_NULOS]) VALUES (9, 92, 58, 25)

INSERT [dbo].[Registros] ([COD_REGISTRO], [VOTOS_BUENOS], [VOTOS_BLANCOS], [VOTOS_NULOS]) VALUES (10, 84, 40, 21)

INSERT [dbo].[TipoJurado] ([ID_TIPO_JURADO], [DESCRIPCION]) VALUES (1, N'Presidente')

INSERT [dbo].[TipoJurado] ([ID_TIPO_JURADO], [DESCRIPCION]) VALUES (2, N'Vicepresidente')

INSERT [dbo].[TipoJurado] ([ID_TIPO_JURADO], [DESCRIPCION]) VALUES (3, N'Vocal')

También podría gustarte