MySQL Forums
Forum List  »  Spanish

problema en claves foraneas
Posted by: Diego Alcorta
Date: October 14, 2006 09:24AM

Soy estudiante de ingenieria, estoy haciendo un trabajo para Base de Datos, no veo en que esta mal el codigo.

Gracias


DROP TABLE IF EXISTS `consorcios`.`consorcio`;
CREATE TABLE `consorcios`.`consorcio` (
`idConsorcio` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`direccion` VARCHAR(45) NOT NULL,
`m2Totales` FLOAT NOT NULL DEFAULT 0,
PRIMARY KEY (`idConsorcio`)
)
ENGINE = InnoDB
CHARACTER SET utf8 COLLATE utf8_general_ci;

DROP TABLE IF EXISTS `consorcios`.`proveedor`;
CREATE TABLE `consorcios`.`proveedor` (
`cuil` INT UNSIGNED NOT NULL,
`tipo` VARCHAR(45) NOT NULL,
`razonSocial` VARCHAR(45) NOT NULL,
PRIMARY KEY (`cuil`)DROP TABLE IF EXISTS `consorcios`.`visita`;
)
ENGINE = InnoDB
CHARACTER SET utf8 COLLATE utf8_general_ci;

CREATE TABLE `consorcios`.`visita` (
`FKconsorcioidConsorcio` NOT NULL,
`FKproveedorcuil` NOT NULL,
`fecha` DATE NOT NULL,
`hora` TIME NOT NULL,
`motivo` VARCHAR(250) NOT NULL,
PRIMARY KEY (`FKconsorcioidConsorcio`, `FKproveedorcuil`),
CONSTRAINT `FKconsorcio` FOREIGN KEY `FKconsorcio` (`FKconsorcioidConsorcio`)
REFERENCES `consorcios`.`consorcio` (`idConsorcio`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `FKproveedor` FOREIGN KEY `FKproveedor` (`FKproveedorcuil`)
REFERENCES `consorcios`.`proveedor` (`cuil`)
ON DELETE NO ACTION
ON UPDATE NO ACTION
)
ENGINE = InnoDB
CHARACTER SET utf8 COLLATE utf8_general_ci;

Options: ReplyQuote


Subject
Views
Written By
Posted
problema en claves foraneas
3421
October 14, 2006 09:24AM
4097
October 14, 2006 10:31AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.