Ver Mensaje Individual
  #9 (permalink)  
Antiguo 29/04/2011, 22:22
Avatar de jorge_developer
jorge_developer
 
Fecha de Ingreso: abril-2011
Ubicación: Lima
Mensajes: 26
Antigüedad: 13 años
Puntos: 2
Respuesta: productos vista horizontal

Claro depende del tipo que le diste en la tabla maesta 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 original
  1. CREATE TABLE IF NOT EXISTS `empleos` (
  2. `id_empleo` INT(10) NOT NULL AUTO_INCREMENT,
  3. `id_categoria` INT(10) NOT NULL,
  4. `id_tipo` INT(10) NOT NULL,
  5. `id_lugar` INT(10) NOT NULL,
  6. `titulo_empleo` VARCHAR(100) NOT NULL,
  7. `fecha_publicacion` datetime NOT NULL,
  8. PRIMARY KEY (`id_empleo`),
  9. FOREIGN KEY (`id_categoria`)
  10.     REFERENCES categoria(`id_categoria`)
  11.    ON UPDATE CASCADE ON DELETE CASCADE,
  12. FOREIGN KEY (`id_tipo`)
  13.     REFERENCES tipo(`id_tipo`)
  14.    ON UPDATE CASCADE ON DELETE CASCADE,
  15. FOREIGN KEY (`id_lugar`)
  16.     REFERENCES lugar(`id_lugar`)
  17.    ON UPDATE CASCADE ON DELETE CASCADE
  18. ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;