MySQL Forums
Forum List  »  Spanish

Re: PROBLEMA CON FOREIGN KEY (FK) MYSQL
Posted by: Gonzalo Garcia Correas
Date: November 26, 2009 07:27AM

Tienes un error de sitaxis, cuando indicas a qué tabla hace referencia una FK también tienes que indicar a qué campo se hace referencia:
ALTER TABLE matricula
ADD CONSTRAINT fk_matricula_curso
FOREIGN KEY idcurso
REFERENCES `curso`(`idcurso`);

Se requiere eso porque no hay forma en que MySQL sepa cuál es el campo, ya que el mismo podría tener un nombre diferente al que aparece en la tabla referenciada.

Options: ReplyQuote


Subject
Views
Written By
Posted
46488
July 11, 2006 07:51AM
3620
February 25, 2010 05:22PM
2959
November 09, 2010 06:58AM
5004
June 07, 2010 03:05PM
3220
August 31, 2011 05:59AM
7241
August 30, 2006 09:33AM
7872
November 14, 2007 03:15AM
3969
June 13, 2011 08:59AM
11445
February 12, 2008 06:04PM
7306
March 11, 2008 05:17AM
3903
April 10, 2010 06:07PM
8115
August 25, 2008 07:22PM
8501
March 23, 2008 09:27AM
5184
April 19, 2008 05:08PM
4687
May 11, 2008 12:28PM
7074
March 28, 2008 10:20AM
6216
June 05, 2008 08:21AM
4666
May 20, 2009 06:30PM
7224
April 18, 2008 12:52PM
4345
May 20, 2009 06:27PM
5153
April 30, 2008 02:21PM
4909
June 05, 2008 08:02AM
6789
May 02, 2008 01:15PM
4840
May 08, 2008 08:13PM
5025
May 08, 2008 09:05AM
7282
June 04, 2008 01:47PM
4603
May 29, 2008 04:34AM
4652
May 29, 2008 05:54AM
4922
June 02, 2008 11:47AM
9503
June 04, 2008 02:01PM
5671
June 05, 2008 07:46AM
6283
June 09, 2008 02:31AM
4402
June 09, 2008 09:53AM
4776
June 11, 2008 10:47AM
5245
June 16, 2008 06:28AM
7303
September 03, 2008 04:34PM
9182
September 05, 2008 04:09AM
5047
December 14, 2008 11:49AM
7250
May 19, 2009 08:31AM
4562
May 19, 2009 08:43AM
3835
July 29, 2009 08:59AM
3795
August 02, 2009 09:19PM
4555
August 02, 2009 03:18PM
4261
August 28, 2009 06:55PM
7489
August 31, 2009 03:02PM
4495
September 14, 2009 01:54PM
4556
September 24, 2009 09:43PM
3747
September 25, 2009 09:30AM
4011
October 07, 2009 01:51AM
5306
November 05, 2009 05:09PM
3936
November 25, 2009 06:51AM
Re: PROBLEMA CON FOREIGN KEY (FK) MYSQL
6594
November 26, 2009 07:27AM
3119
November 26, 2009 04:13AM
3628
December 28, 2009 10:31PM
4155
February 02, 2010 09:55AM
8470
February 12, 2010 08:35AM
4045
March 01, 2010 03:08PM
3299
March 03, 2010 08:23AM
5090
March 05, 2010 07:57AM
2843
March 06, 2010 04:37PM
4446
April 13, 2010 03:43PM
3054
August 08, 2010 03:15PM
2523
August 08, 2010 03:54PM
1902
September 15, 2010 10:06AM
9260
September 18, 2010 10:24AM
2067
October 10, 2010 10:05AM
1825
November 13, 2010 05:53AM
1985
October 18, 2010 04:05PM
1836
October 18, 2010 07:34PM
1851
January 20, 2011 03:13PM
2815
February 14, 2011 09:18AM
2678
January 31, 2011 04:19PM
2610
February 02, 2011 11:41AM
1697
March 17, 2011 01:35PM
1933
July 30, 2011 10:51PM
1327
August 15, 2011 03:50PM
2209
September 20, 2011 10:54AM
1175
September 20, 2011 01:53PM


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.