Skip to content

Instantly share code, notes, and snippets.

@rbatty19
Last active April 27, 2019 20:10
Show Gist options
  • Save rbatty19/219e230f808455a9e379cab6cd0c2ea6 to your computer and use it in GitHub Desktop.
Save rbatty19/219e230f808455a9e379cab6cd0c2ea6 to your computer and use it in GitHub Desktop.
Base de Datos_ SEM5
a. Generar una consulta agrupando por código y nombre de entidad para determinar cuántos proyectos gestiona y el valor total del presupuesto. Ordenar por Nombre de Entidad.
select count(*) as Cantidad, E.NomEntidad, sum(Presupuesto) as Presupuesto from Proyectos P, Entidades E where P.CodEntidad = E.CodEntidad
group by E.CodEntidad, E.NomEntidad order by E.NomEntidad;
b. Nombre del proyecto, Fecha Inicial, Fecha Final y Presupuesto de los proyectos que financia Colciencias que tengan presupuesto mayor a $500,000,000
select P.NomProyecto, P.FecInicio, P.FecFin, P.Presupuesto from Proyectos P, Entidades E where P.CodEntidad = E.CodEntidad and E.NomEntidad = 'ICFES' and P.Presupuesto > 500000000;
c. Nombre y código de los investigadores de Cartagena que sean investigadores Principales. Ordenar por Nombre de Investigador
select distinct I.NomInvestigador, I.CodInvestigador from Investigadores I, Ciudades C, Asignaciones A where I.CodInvestigador = A.CodInvestigador and A.Tipo = 'Principal' and C.NomCiudad = 'CARTAGENA' and I.CodCiudad = C.CodCiudadorder by I.CodInvestigador;
d. Actualizar la ciudad de los investigadores de Bogotá ya que se mudaron a Barranquilla
update Investigadores set CodCiudad = 'BAQ' where CodCiudad='BOG';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment