SlideShare una empresa de Scribd logo
1 de 20
Julián Araneda
Gonzalo Berger
Antonio Lena
Sebastián Urrutia
Gastón Martini
Sistemas de Bases de Datos II
Base de Datos
La base de datos sobre la que trabajamos
está constituida por partes, proveedores y
proyectos, los cuáles a su vez se
encuentran relacionados, formando una
cuarta tabla de envíos.
Tablas
Las tablas resultantes son:
• S (proveedores).
• P (partes).
• J (proyectos).
• SPJ (envíos).
Proveedores
La tabla de proveedores está constituida
por los siguientes atributos:
sid: Identificador del proveedor.
snombre: Nombre del proveedor.
situacion: Situación del proveedor.
ciudad: Ciudad del proveedor.
Partes
La tabla de partes está constituida por los
siguientes atributos:
pid: Identificador de la parte.
pnombre: Nombre de la parte.
color: Color de la parte.
peso: Peso de la parte.
ciudad: Ciudad de la parte.
Proyectos
La tabla de proyectos está constituida por
los siguientes atributos:
jid: Identificador del proyecto.
jnombre: Nombre del proyecto.
ciudad: Ciudad del proyecto.
Funciones agregadas
 Count (atributo clave) – Numero de valores
en la columna.
 Count (*) – Numero de valores en la
columna, los valores nulos se manejan
igual a los no nulos.
 Sum (atributo clave numérico) - Suma de
los valores de la columna.
 Avg (Atributo clave numérico) – Promedio
de los valores de la columna.
 Max () – Valor mas grande en la columna.
 Min () – Valor mas pequeño en la columna.
Consulta 1
 Obtener el numero de proveedores
 Select count (*) from s;
Consulta 2
 Obtener el numero total de proveedores
que suministran partes en la actualidad.
 Select count (distinct sid) from spj;
Consulta 3
 Obtener el numero de envíos de la parte
P2.
 Select count (*) from spj where pid=‘P2’;
Consulta 4
 Obtener la cantidad total suministrada
de la parte P2
 Select sum(cantidad) from spj where
pid=‘P2’
Consulta 5
 Obtener para cada parte suministrada el
numero de parte y la cantidad enviada
de esa parte.
 Select pid, sum(cantidad) from spj group
by pid;
Consulta 6
 Obtener los números de todas las
partes suministradas por mas de un
proveedor.
 Select pid from spj group by pid having
count(*) > 1;
Consulta 7
 Obtener todas las partes cuyos nombres
comiencen con “B”.
 Select * from p where pnombre like
‘B%’;
Consulta 9
 Obtener todos los nombres de los
proveedores que suministran la parte
P2.
 Select snombre from s where sid in
(select sid from spj where pid = ‘P2’)
Consulta 10
 Obtener todos los nombres de los
proveedores que suministran la parte P2
 Select snombre from s,spj where s.sid =
spj.sid and spj.pid=‘P2’
Consulta 11
 Obtener los nombres de los
proveedores que suministran por lo
menos una parte roja.
 Select distinct s.snombre from s, p, spj
where s.sid=spj.sid and p.pid=spj.pid
and p.color=‘Rojo’
Consulta 12
 Obtener los números de proveedores
situados en la misma ciudad que el
proveedor “S1”.
 Select sid from s where ciudad = (select
ciudad from s where sid=‘S1’)
Consulta 13
 Obtener los números de proveedores
cuya situación sea menor que el valor
máximo actual de la situación en la tabla
s.
 Select sid from s where situacion <
(select max (situacion) from s)
Consulta 14
 Obtener los nombres de proveedores
que suministran la parte P2.
 Select snombre from s where exists
(select * from spj where spj.sid = s.sid
and pid=‘P2’)

Más contenido relacionado

Último

Ciberseguridad y Seguridad Informática Franco Correa Grupo B.pptx
Ciberseguridad y Seguridad Informática Franco Correa Grupo B.pptxCiberseguridad y Seguridad Informática Franco Correa Grupo B.pptx
Ciberseguridad y Seguridad Informática Franco Correa Grupo B.pptxcorreafrancoci00
 
TECNOLOGIA DE LA INFORMACION Y MULTIMEDIA 15 MAYO.pptx
TECNOLOGIA DE LA INFORMACION Y MULTIMEDIA 15 MAYO.pptxTECNOLOGIA DE LA INFORMACION Y MULTIMEDIA 15 MAYO.pptx
TECNOLOGIA DE LA INFORMACION Y MULTIMEDIA 15 MAYO.pptxUPSE
 
El necesario mal del Legacy Code (Drupal Iberia 2024)
El necesario mal del Legacy Code (Drupal Iberia 2024)El necesario mal del Legacy Code (Drupal Iberia 2024)
El necesario mal del Legacy Code (Drupal Iberia 2024)Samuel Solís Fuentes
 
CIBERSEGURIDAD Y SEGURIDAD INFORMÁTICA.pptx
CIBERSEGURIDAD  Y SEGURIDAD INFORMÁTICA.pptxCIBERSEGURIDAD  Y SEGURIDAD INFORMÁTICA.pptx
CIBERSEGURIDAD Y SEGURIDAD INFORMÁTICA.pptxalzabenjaminci00
 
Especificación casos de uso del negocio
Especificación  casos de uso del negocioEspecificación  casos de uso del negocio
Especificación casos de uso del negocioMagemyl Egana
 
serenidad APP presentacion.pdfes una innovadora aplicación móvil diseñada par...
serenidad APP presentacion.pdfes una innovadora aplicación móvil diseñada par...serenidad APP presentacion.pdfes una innovadora aplicación móvil diseñada par...
serenidad APP presentacion.pdfes una innovadora aplicación móvil diseñada par...juanforero141
 
TECNOLOGÍA DE LA INFORMACIÓN SLIDESHARE INVESTIGACION.pdf
TECNOLOGÍA DE LA INFORMACIÓN SLIDESHARE INVESTIGACION.pdfTECNOLOGÍA DE LA INFORMACIÓN SLIDESHARE INVESTIGACION.pdf
TECNOLOGÍA DE LA INFORMACIÓN SLIDESHARE INVESTIGACION.pdfUPSE
 
Tipos de datos en Microsoft Access definiciones.pdf
Tipos de datos en Microsoft Access definiciones.pdfTipos de datos en Microsoft Access definiciones.pdf
Tipos de datos en Microsoft Access definiciones.pdfCarlosSanchez452245
 
Modelado de Casos de uso del negocio
Modelado de  Casos  de  uso  del negocioModelado de  Casos  de  uso  del negocio
Modelado de Casos de uso del negocioMagemyl Egana
 

Último (9)

Ciberseguridad y Seguridad Informática Franco Correa Grupo B.pptx
Ciberseguridad y Seguridad Informática Franco Correa Grupo B.pptxCiberseguridad y Seguridad Informática Franco Correa Grupo B.pptx
Ciberseguridad y Seguridad Informática Franco Correa Grupo B.pptx
 
TECNOLOGIA DE LA INFORMACION Y MULTIMEDIA 15 MAYO.pptx
TECNOLOGIA DE LA INFORMACION Y MULTIMEDIA 15 MAYO.pptxTECNOLOGIA DE LA INFORMACION Y MULTIMEDIA 15 MAYO.pptx
TECNOLOGIA DE LA INFORMACION Y MULTIMEDIA 15 MAYO.pptx
 
El necesario mal del Legacy Code (Drupal Iberia 2024)
El necesario mal del Legacy Code (Drupal Iberia 2024)El necesario mal del Legacy Code (Drupal Iberia 2024)
El necesario mal del Legacy Code (Drupal Iberia 2024)
 
CIBERSEGURIDAD Y SEGURIDAD INFORMÁTICA.pptx
CIBERSEGURIDAD  Y SEGURIDAD INFORMÁTICA.pptxCIBERSEGURIDAD  Y SEGURIDAD INFORMÁTICA.pptx
CIBERSEGURIDAD Y SEGURIDAD INFORMÁTICA.pptx
 
Especificación casos de uso del negocio
Especificación  casos de uso del negocioEspecificación  casos de uso del negocio
Especificación casos de uso del negocio
 
serenidad APP presentacion.pdfes una innovadora aplicación móvil diseñada par...
serenidad APP presentacion.pdfes una innovadora aplicación móvil diseñada par...serenidad APP presentacion.pdfes una innovadora aplicación móvil diseñada par...
serenidad APP presentacion.pdfes una innovadora aplicación móvil diseñada par...
 
TECNOLOGÍA DE LA INFORMACIÓN SLIDESHARE INVESTIGACION.pdf
TECNOLOGÍA DE LA INFORMACIÓN SLIDESHARE INVESTIGACION.pdfTECNOLOGÍA DE LA INFORMACIÓN SLIDESHARE INVESTIGACION.pdf
TECNOLOGÍA DE LA INFORMACIÓN SLIDESHARE INVESTIGACION.pdf
 
Tipos de datos en Microsoft Access definiciones.pdf
Tipos de datos en Microsoft Access definiciones.pdfTipos de datos en Microsoft Access definiciones.pdf
Tipos de datos en Microsoft Access definiciones.pdf
 
Modelado de Casos de uso del negocio
Modelado de  Casos  de  uso  del negocioModelado de  Casos  de  uso  del negocio
Modelado de Casos de uso del negocio
 

Destacado

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Destacado (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Funciones agregadas en Informix

  • 1. Julián Araneda Gonzalo Berger Antonio Lena Sebastián Urrutia Gastón Martini Sistemas de Bases de Datos II
  • 2. Base de Datos La base de datos sobre la que trabajamos está constituida por partes, proveedores y proyectos, los cuáles a su vez se encuentran relacionados, formando una cuarta tabla de envíos.
  • 3. Tablas Las tablas resultantes son: • S (proveedores). • P (partes). • J (proyectos). • SPJ (envíos).
  • 4. Proveedores La tabla de proveedores está constituida por los siguientes atributos: sid: Identificador del proveedor. snombre: Nombre del proveedor. situacion: Situación del proveedor. ciudad: Ciudad del proveedor.
  • 5. Partes La tabla de partes está constituida por los siguientes atributos: pid: Identificador de la parte. pnombre: Nombre de la parte. color: Color de la parte. peso: Peso de la parte. ciudad: Ciudad de la parte.
  • 6. Proyectos La tabla de proyectos está constituida por los siguientes atributos: jid: Identificador del proyecto. jnombre: Nombre del proyecto. ciudad: Ciudad del proyecto.
  • 7. Funciones agregadas  Count (atributo clave) – Numero de valores en la columna.  Count (*) – Numero de valores en la columna, los valores nulos se manejan igual a los no nulos.  Sum (atributo clave numérico) - Suma de los valores de la columna.  Avg (Atributo clave numérico) – Promedio de los valores de la columna.  Max () – Valor mas grande en la columna.  Min () – Valor mas pequeño en la columna.
  • 8. Consulta 1  Obtener el numero de proveedores  Select count (*) from s;
  • 9. Consulta 2  Obtener el numero total de proveedores que suministran partes en la actualidad.  Select count (distinct sid) from spj;
  • 10. Consulta 3  Obtener el numero de envíos de la parte P2.  Select count (*) from spj where pid=‘P2’;
  • 11. Consulta 4  Obtener la cantidad total suministrada de la parte P2  Select sum(cantidad) from spj where pid=‘P2’
  • 12. Consulta 5  Obtener para cada parte suministrada el numero de parte y la cantidad enviada de esa parte.  Select pid, sum(cantidad) from spj group by pid;
  • 13. Consulta 6  Obtener los números de todas las partes suministradas por mas de un proveedor.  Select pid from spj group by pid having count(*) > 1;
  • 14. Consulta 7  Obtener todas las partes cuyos nombres comiencen con “B”.  Select * from p where pnombre like ‘B%’;
  • 15. Consulta 9  Obtener todos los nombres de los proveedores que suministran la parte P2.  Select snombre from s where sid in (select sid from spj where pid = ‘P2’)
  • 16. Consulta 10  Obtener todos los nombres de los proveedores que suministran la parte P2  Select snombre from s,spj where s.sid = spj.sid and spj.pid=‘P2’
  • 17. Consulta 11  Obtener los nombres de los proveedores que suministran por lo menos una parte roja.  Select distinct s.snombre from s, p, spj where s.sid=spj.sid and p.pid=spj.pid and p.color=‘Rojo’
  • 18. Consulta 12  Obtener los números de proveedores situados en la misma ciudad que el proveedor “S1”.  Select sid from s where ciudad = (select ciudad from s where sid=‘S1’)
  • 19. Consulta 13  Obtener los números de proveedores cuya situación sea menor que el valor máximo actual de la situación en la tabla s.  Select sid from s where situacion < (select max (situacion) from s)
  • 20. Consulta 14  Obtener los nombres de proveedores que suministran la parte P2.  Select snombre from s where exists (select * from spj where spj.sid = s.sid and pid=‘P2’)