Base de datos Northwind
La base de datos Nortwind es una base de datos de una empresa ficticia que se utiliza en los productos Microsoft como base de datos completa y para practicar. Nortwind Traders es una organización ficticia que gestiona pedidos, productos, proveedores y muchos aspectos.
Objetivos
Herramientas
En esta fase inicial, se empleará SQL con PostgreSQL para realizar analisis de datos. PostgreSQL se elige por su fiabilidad y capacidad para manejar grandes volúmenes de datos. Las consultas SQL se utilizaran para explorar, limpiar y optimizar la base de datos.
Datos
Sección Básica e Intermedia
SELECT product_name, unit_price, discontinued FROM products ORDER BY unit_price DESC LIMIT 10;
SELECT product_name, unit_price, discontinued FROM products WHERE unit_price >75;
SELECT product_name, category_id, unit_price, quantity_per_unit, units_in_stock FROM products WHERE (unit_price <20 AND category_id=1);
SELECT company_name, contact_name, address, country FROM customers WHERE country= 'USA' OR country='France';
SELECT last_name, first_name, country, home_phone FROM employees WHERE birth_date BETWEEN '1950-01-01' AND '1960-01-01';
SELECT first_name, last_name, birth_date, home_phone FROM employees WHERE last_name LIKE 'D%';
SELECT product_name, supplier_id, quantity_per_unit, reorder_level FROM products WHERE supplier_id IN (2,6);
SELECT SUM(unit_price) as suma_productos FROM products;
SELECT supplier_id,round(avg(unit_price)) as avg_precio FROM products GROUP BY supplier_id ORDER BY avg_precio;
SELECT od.product_id, SUM(od.quantity) AS total_vendido, (SELECT unit_price FROM products WHERE product_id=od.product_id) AS price FROM order_details od GROUP BY od.product_id;
SELECT e.first_name, e.last_name, ( SELECT SUM(od.quantity) FROM orders o, order_details od WHERE o.employee_id=e.employee_id AND od.order_id=o.order_id ) as unidades_totales FROM employees e;