Ver Mensaje Individual
  #4 (permalink)  
Antiguo 17/02/2006, 13:32
tammander
 
Fecha de Ingreso: enero-2006
Ubicación: Torroles (Costa der Só)
Mensajes: 1.017
Antigüedad: 19 años, 4 meses
Puntos: 7
Un ejemplo de maestro-detalle es una factura o un albarán: Tiene una cabecera con datos generales (Numero factura, cliente, total, fecha, etc) y un detalle de todos los productos detalle.

TABLA CAB_FACTURA

idfactura int(11) auto_increment not null promary key,
fecha date null,
numerofact varchar(45) null,
idcliente int(11) not null,
total_factura decimal (11,2) null,
descuento double,
observaciones text null,
key fechas (fecha)


TABLA DETALLE_FACTURA
iddeta int(11) auto_increment not null primary key,
idcab int(11) not null,
idproducto int(11) not null,
precio decimal (11,2) not null,
key cabceras (idcab)


Esto son tablas tipicas maestro-detalle.




Un saludo