MySQL Forums
Forum List  »  Spanish

claves foraneas
Posted by: gabriel aguilar
Date: March 06, 2012 09:32AM

buena jornada a la comunidad !
explico,estoy usando el mysql administrator, bajo MySQL 5.1.61, pues soy un novato en mysql.
tengo tres tablas en la base.
tregistro
tfecha
tevento
------------------
tregistro
id registro , clave primaria
id fecha , deberia ser clave foranea
id evento , deberia ser clave foranea

--------------------
tfecha
id fecha
--------------------
tevento
id evento
--------------------
dejo parte del codigo que genera administrator

CREATE TABLE `tregistro` (
`id registro` int(11) NOT NULL AUTO_INCREMENT,
`id fecha` int(11) NOT NULL,
`id evento` int(11) NOT NULL,
`1elemento` int(11) NOT NULL,
`2elemento` int(11) NOT NULL,
`3elemento` int(11) NOT NULL,
PRIMARY KEY (`id registro`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

-----------------------------------------

CREATE TABLE `tfecha` (
`id fecha` int(11) NOT NULL AUTO_INCREMENT,
`fecha` date NOT NULL,
PRIMARY KEY (`id fecha`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

---------------------------------------------

CREATE TABLE `tevento` (
`id evento` int(11) NOT NULL,
`evento` int(11) NOT NULL,
PRIMARY KEY (`id evento`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1


alguien me podria ayudar con el codigo,pues cuando utilizo el "administrator" me genera un codigo con error de sintaxis y necesito relacionar las tablas a traves de sus claves foraneas
desde ya , muchas gracias



Edited 2 time(s). Last edit at 03/08/2012 07:52AM by gabriel aguilar.

Options: ReplyQuote


Subject
Views
Written By
Posted
claves foraneas
1550
March 06, 2012 09:32AM


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.