
29/04/2011, 22:23
|
 | | | Fecha de Ingreso: abril-2011 Ubicación: Lima
Mensajes: 26
Antigüedad: 13 años, 11 meses Puntos: 2 | |
Respuesta: productos vista horizontal Cita:
Iniciado por jorge_developer Claro depende del tipo que le diste en la tabla maestra por ejemplo si en categoria es id_categoria int(10) en la tabla empleo debes hacer lo mismo.
Noto q estas trabajando en mysql con tipo InnoDB que es para base de datos relacionales entonces cuando colocas un campo de una tabla maestra en una hija debes hacer la referncia con FOREIGN KEY
entonces tu bd quedaria asi:
Código SQL:
Ver originalCREATE TABLE IF NOT EXISTS `empleos` ( `id_empleo` INT(10) NOT NULL AUTO_INCREMENT, `id_categoria` INT(10) NOT NULL, `id_tipo` INT(10) NOT NULL, `id_lugar` INT(10) NOT NULL, `titulo_empleo` VARCHAR(100) NOT NULL, `fecha_publicacion` datetime NOT NULL, PRIMARY KEY (`id_empleo`), FOREIGN KEY (`id_categoria`) REFERENCES categoria(`id_categoria`) ON UPDATE CASCADE ON DELETE CASCADE, FOREIGN KEY (`id_tipo`) REFERENCES tipo(`id_tipo`) ON UPDATE CASCADE ON DELETE CASCADE, FOREIGN KEY (`id_lugar`) REFERENCES lugar(`id_lugar`) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|