Consultas a la base de datos
Búsqueda de un dato sencillo por estación, servicio y fecha
Buscar el valor del Caudal máximo, de la Estación de Puerto Salgar en Noviembre de 1972
Buscar el valor del Caudal máximo, de la Estación de Puerto Salgar en Noviembre de 1972
"SELECT Valor
FROM Evento
WHERE (id_estacion=1 and id_servicio=1 and id_fechas=323);"
FROM Evento
WHERE (id_estacion=1 and id_servicio=1 and id_fechas=323);"
Consulta1 |
Valor |
2630 |
Búsqueda de un Rango
Buscar los valores del caudal medio de la estación Puerto Berrío en Enero de 2003
"SELECT Valor
FROM Evento
WHERE (id_estacion=2 and id_servicio=2 and id_fechas>685 and id_fechas<696);"
Consulta1 |
Valor |
1103 |
1450 |
2360 |
1910 |
2394 |
1577 |
1458 |
1478 |
2304 |
2969 |
Busqueda de Servicios
Averiguar cuantas estaciones poseen más de 3 servicios
Averiguar cuantas estaciones poseen más de 3 servicios
"SELECT id_estacion
FROM Evento
WHERE id_servicio>3;"
FROM Evento
WHERE id_servicio>3;"
Consulta1 |
id_estacion |
1 |
Consultar las propiedades geográficas de las estaciones
"SELECT id_estacion, Latitud, Longitud, Elevacion, Fecha_inst
FROM Estacion ;"
"SELECT id_estacion, Latitud, Longitud, Elevacion, Fecha_inst
FROM Estacion ;"
Consulta1 | ||||
id_estacion | Latitud | Longitud | Elevacion | Fecha_inst |
1 | 0528 N | 7440 W | 0168 m.s.n.m | 1936-ENE |
2 | 0630 N | 7423 W | 0108 m.s.n.m | 1936-ENE |
Consignar cuantos servicios ofrece actualmente el Ideam en sus 2 estaciones
"SELECT id_servicio, Nombre, Unidades
FROM Servicios"
FROM Servicios"
Consulta1 | ||
id_servicio | Nombre | Unidades |
1 | Caudal Maximo | m3/s |
2 | Caudal Medio | m3/s |
3 | Niveles | cm |
4 | Sedimentos | Kg/m3 |
Encontrar la cantidad total de sedimentos que pasaron por la estación de Puerto Salgar entre 1984 y 1994
"SELECT SUM(Valor)
FROM Evento
WHERE (id_estacion=1 and id_servicio=4 and id_fechas>457 and id_fechas<588);"
FROM Evento
WHERE (id_estacion=1 and id_servicio=4 and id_fechas>457 and id_fechas<588);"
Consulta2 |
Expr1000 |
68,69 |
Analizar el promedio de los niveles del río en puerto Berrío para el año 2000
"SELECT AVG(Valor)
FROM Evento
WHERE (id_estacion=2 and id_servicio=3 and id_fechas>649 and id_fechas<660);"
FROM Evento
WHERE (id_estacion=2 and id_servicio=3 and id_fechas>649 and id_fechas<660);"
Consulta2 |
Expr1000 |
404,5 |
Examinar el máximo caudal máximo de la estación de Puerto Salgar para el quinquenio comprendido entre 1985 y 1990
"SELECT MAX(Valor)
FROM Evento
WHERE (id_estacion=1 and id_servicio=1 and id_fechas>469 and id_fechas<540);"
"SELECT MAX(Valor)
FROM Evento
WHERE (id_estacion=1 and id_servicio=1 and id_fechas>469 and id_fechas<540);"
Consulta2 |
Expr1000 |
5003 |
Identificar el valor mínimo de Caudal Medio para Puerto Berrío en la década de los 90
"SELECT MIN(Valor)
FROM Evento
WHERE (id_estacion=2 and id_servicio=2 and id_fechas>529 and id_fechas<660);"
FROM Evento
WHERE (id_estacion=2 and id_servicio=2 and id_fechas>529 and id_fechas<660);"
Consulta2 |
Expr1000 |
859 |
Mostrar en una tabla el valor máximo de los niveles del río para las estaciones de Puerto Salgar y Puerto Berrío desde 1980 a la fecha.
"SELECT MAX(Valor)
FROM Evento
WHERE (id_estacion=1 and id_servicio=3 and id_fechas>409)
UNION
SELECT MAX(Valor)
FROM Evento
WHERE (id_estacion=2 and id_servicio=3 and id_fechas>409);"
FROM Evento
WHERE (id_estacion=1 and id_servicio=3 and id_fechas>409)
UNION
SELECT MAX(Valor)
FROM Evento
WHERE (id_estacion=2 and id_servicio=3 and id_fechas>409);"
Consulta2 |
Expr1000 |
500 |
518 |
Esta bastante interesante la información que se puede optener de la base de datos!
ResponderEliminar