grupo n°1 - aillón paola y gallardo patricia
TRANSCRIPT
![Page 1: Grupo N°1 - Aillón Paola y Gallardo Patricia](https://reader030.vdocuments.site/reader030/viewer/2022032700/55d27a2dbb61eb5d128b45f3/html5/thumbnails/1.jpg)
UNIVERSIDAD CENTRAL DEL ECUADORFACULTAD DE CIENCIAS ECONÓMICAS
ESCUELA ESTADÍSTICA
SUBCONSULTA
Integrantes:
Paola Katherine Aillón CarrilloPatricia Daniela Gallardo Zambrano
![Page 2: Grupo N°1 - Aillón Paola y Gallardo Patricia](https://reader030.vdocuments.site/reader030/viewer/2022032700/55d27a2dbb61eb5d128b45f3/html5/thumbnails/2.jpg)
Es el lenguaje estándar para dirigir el sistema de la base de datos relacional.
SQL
![Page 3: Grupo N°1 - Aillón Paola y Gallardo Patricia](https://reader030.vdocuments.site/reader030/viewer/2022032700/55d27a2dbb61eb5d128b45f3/html5/thumbnails/3.jpg)
• Es una expresión y un operador.
Comparación
• Por la que se busca el conjunto resultante de la subconsulta.
Expresión• Es una introducción
SELECT, que sigue el mismo formato y reglas que cualquier otra Introducción SELECT.
Introducción
SQL
SUBCONSULTAUna instrucción SELECT anidada dentro de una
instrucción SELECT. SIEMPRE (comando
SELECT entre paréntesis) se ejecuta primero y,
posteriormente, el valor extraído es utilizado en la consulta principal.
TRES FORMAS DE SINTAXIS
Consiste en utilizar los resultados de una consulta dentro de otra, que se considera la principal.
![Page 4: Grupo N°1 - Aillón Paola y Gallardo Patricia](https://reader030.vdocuments.site/reader030/viewer/2022032700/55d27a2dbb61eb5d128b45f3/html5/thumbnails/4.jpg)
• WHERE • HAVING
Comparación
• ORDEN BY• UNION de
varias SELECT
No contiene
• No utilizar campos
calculados en la subconsulta.
Restricciones
CONDICIONES DE SELECCIÓN EN LAS CLAUSULASY
RESTRICCIONES
Si aparece en la lista de selección, o esta asociada a un operador = solo puede devolver un único registro.
![Page 5: Grupo N°1 - Aillón Paola y Gallardo Patricia](https://reader030.vdocuments.site/reader030/viewer/2022032700/55d27a2dbb61eb5d128b45f3/html5/thumbnails/5.jpg)
NUEVAS CONDICIONES DE SELECCIÓN
Test de existencia
Test de pertenencia
a un conjunto
Test de comparació
n cuantificad
a
Test de comparació
n con subconsult
a
![Page 6: Grupo N°1 - Aillón Paola y Gallardo Patricia](https://reader030.vdocuments.site/reader030/viewer/2022032700/55d27a2dbb61eb5d128b45f3/html5/thumbnails/6.jpg)
EL TEST DE COMPARACIÓN DE SUBCONSULTA
La sintaxis es la siguiente:
EL TEST DE COMPARACIÓN DE CUANTIFICADA
La sintaxis es la siguiente:
![Page 7: Grupo N°1 - Aillón Paola y Gallardo Patricia](https://reader030.vdocuments.site/reader030/viewer/2022032700/55d27a2dbb61eb5d128b45f3/html5/thumbnails/7.jpg)
EL TEST DE PERTENENCIA A UN CONJUNTO
La sintaxis es la siguiente:
EL TEST DE EXISTENCIA
La sintaxis es la siguiente:
![Page 8: Grupo N°1 - Aillón Paola y Gallardo Patricia](https://reader030.vdocuments.site/reader030/viewer/2022032700/55d27a2dbb61eb5d128b45f3/html5/thumbnails/8.jpg)
¿ CÓMO SE EJECUTA?
Se ejecuta por cada fila de la consulta
principal.
También se ejecuta la subconsulta y se filtra
con la consulta principal
Son más fáciles de interpretar por el
usuario.
![Page 9: Grupo N°1 - Aillón Paola y Gallardo Patricia](https://reader030.vdocuments.site/reader030/viewer/2022032700/55d27a2dbb61eb5d128b45f3/html5/thumbnails/9.jpg)
EJEMPLO PRACTICO EN ACCESS
Queremos saber la lista de empleados cuyo salario supere el salario medio. En primer lugar, tendríamos que averiguar el importe del salario medio.
EMPRESA LOS LIDERES
![Page 10: Grupo N°1 - Aillón Paola y Gallardo Patricia](https://reader030.vdocuments.site/reader030/viewer/2022032700/55d27a2dbb61eb5d128b45f3/html5/thumbnails/10.jpg)
![Page 11: Grupo N°1 - Aillón Paola y Gallardo Patricia](https://reader030.vdocuments.site/reader030/viewer/2022032700/55d27a2dbb61eb5d128b45f3/html5/thumbnails/11.jpg)
EJEMPLO 2
EJEMPLO 3
Obtenga el nombre, apellido de los clientes que tengan la mayor edad.
Obtiene una lista con el nombre, cargo y salario de todos los agentes de Gerente salario es mayor que el de todos Administrado y Directores.
![Page 12: Grupo N°1 - Aillón Paola y Gallardo Patricia](https://reader030.vdocuments.site/reader030/viewer/2022032700/55d27a2dbb61eb5d128b45f3/html5/thumbnails/12.jpg)
BIBLIOGRAFÍA
• file:///C:/Users/sony/AppData/Local/Temp/SQL.pdf
• http://www.aulaclic.es/sql/t_5_2.htm
• http://www.desarrolloweb.com/articulos/2337.php