
25/02/2014, 04:47
|
| | Fecha de Ingreso: noviembre-2012
Mensajes: 184
Antigüedad: 12 años, 3 meses Puntos: 0 | |
Respuesta: Relación de Generalización/Especialización Vale!
mi problemas es que no se si generalización y especialización es un mismo concepto o son varios.
A continuación adjunto el código de las modificaciones considerando que es disyunta y total:
Código:
CREATE TABLE IF NOT EXISTS `precio_dia` (
`activ` tinyint(3) unsigned NOT NULL,
`org` enum('GRCSL','UCA') NOT NULL DEFAULT 'GRCSL',
`ano` year(4) NOT NULL,
`clase` decimal(4,2) unsigned NOT NULL,
`dia_med` decimal(5,2) unsigned NOT NULL,
`dia_comp` decimal(5,2) unsigned NOT NULL,
FOREIGN KEY (`activ`) REFERENCES `actividad` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY (`activ`,`org`,`ano`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `precio_edad` (
`activ` tinyint(3) unsigned NOT NULL,
`org` enum('GRCSL','UCA') NOT NULL DEFAULT 'GRCSL',
`ano` year(4) NOT NULL,
`clase` decimal(4,2) unsigned NOT NULL,
`l_edad` tinyint(3) unsigned NOT NULL,
`edad1` decimal(5,2) unsigned NOT NULL,
`edad2` decimal(5,2) unsigned NOT NULL,
FOREIGN KEY (`activ`) REFERENCES `actividad` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY (`activ`,`org`,`ano`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `precio_mes` (
`activ` tinyint(3) unsigned NOT NULL,
`org` enum('GRCSL','UCA') NOT NULL DEFAULT 'GRCSL',
`ano` year(4) NOT NULL,
`clase` decimal(4,2) unsigned NOT NULL,
`mes` decimal(5,2) unsigned NOT NULL,
FOREIGN KEY (`activ`) REFERENCES `actividad` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY (`activ`,`org`,`ano`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `precio_semanal` (
`activ` tinyint(3) unsigned NOT NULL,
`org` enum('GRCSL','UCA') NOT NULL DEFAULT 'GRCSL',
`ano` year(4) NOT NULL,
`clase` decimal(4,2) unsigned NOT NULL,
`1d` decimal(5,2) unsigned NOT NULL,
`2d` decimal(5,2) unsigned NOT NULL,
`3d` decimal(5,2) unsigned NOT NULL,
`4d` decimal(5,2) unsigned NOT NULL,
`5d` decimal(5,2) unsigned NOT NULL,
FOREIGN KEY (`activ`) REFERENCES `actividad` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY (`activ`,`org`,`ano`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Yo lo que pienso es que si van en tablas separadas como se diferencia los tipos de generalización o especialización?¿? Habría que añadir un atributo de 'tipo'??
Muchas gracias por tu aporte! Un saludo!
Última edición por Cota_Isla; 25/02/2014 a las 05:55 |