The document contains examples of JOIN queries on multiple tables in a papeleria (stationary store) database. The JOINs link tables related to addresses, invoices, products, product types, and inventory locations. Specifically, it joins tables together to link addresses to municipalities and delegations, invoices to customers and payments, products to colors, sizes and prices, product types to specific items like paper and pens, and inventory locations to warehouses, aisles and shelves.
The document contains examples of JOIN queries on multiple tables in a papeleria (stationary store) database. The JOINs link tables related to addresses, invoices, products, product types, and inventory locations. Specifically, it joins tables together to link addresses to municipalities and delegations, invoices to customers and payments, products to colors, sizes and prices, product types to specific items like paper and pens, and inventory locations to warehouses, aisles and shelves.
The document contains examples of JOIN queries on multiple tables in a papeleria (stationary store) database. The JOINs link tables related to addresses, invoices, products, product types, and inventory locations. Specifically, it joins tables together to link addresses to municipalities and delegations, invoices to customers and payments, products to colors, sizes and prices, product types to specific items like paper and pens, and inventory locations to warehouses, aisles and shelves.
Materia: Inteligencia de Negocios Docente: Luis Gerardo Alfaro Melndez Alumno: Mndez Aguilera Diana Paola Pacheco Andrade Abdi Salomon
Chalco, Estado de Mxico, a 20 de Junio del 2014.
2
Joins Join de tas tablas Domicilio, municipio, delegacion y colonia
select * from domicilio as dom inner join colonia as c on dom.id_colonia= c. id_colonia inner join delegacion as del on c.id_colonia = del.id_colonia inner join municipio as m on del.id_delegacion = m.id_delegacion
3
Join de las tablas Factura, detalle_factura, ventas, formas de pago, pago y cliente
select * from factura as f inner join detalle_factura as df on f.id_factura = df.id_factura inner join venta as v on f.id_factura = v.id_factura inner join formas_pago as fp on v.id_venta = fp.id_venta inner join pago as p on fp.id_pago = p.id_pago inner join cliente as c on f.id_cliente = c.id_cliente
select * from producto as p inner join producto_color as pc on p.id_producto = pc.id_producto inner join color as c on pc.id_color = c.id_color inner join producto_tamao as pt on p.id_producto = pt.id_producto inner join tamao as t on pt.id_tamao = t.id_tamao inner join producto_precio as pp on p.id_producto = pp.id_producto inner join precio as pr on pp.id_precio = pr.id_precio
5
Join de las tablas Tipo, producto_tipo, tipo_libreta, libreta, tipo_papel, papel, tipo_lapicero, lapicero
select * from tipo as t inner join producto_tipo as pt on t.id_tipo = pt.id_tipo inner join tipo_papel as tip on t.id_tipo = tip.id_tipo inner join papel as p on tip.id_papel = p.id_papel inner join tipo_libreta as tl on t.id_tipo = tl.id_tipo inner join libreta as l on tl.id_libreta = l.id_libreta inner join tipo_lapicero as tlap on t.id_tipo = tlap.id_tipo inner join lapicero as lap on tlap.id_lapicero = lap.id_lapicero
6
Joins de las tablas Existencia, ubicacin, almacen, rea, pasillo y estante.
select * from existencia as e inner join ubicacion as u on e.id_existencia = u.id_existencia inner join almacen as a on u.id_almacen = a.id_almacen inner join area as ar on a.id_area = ar.id_area inner join pasillo as p on ar.id_pasillo = p.id_pasillo inner join estante as est on p.id_estante = est.id_estante