This is a question onto defining foreign keys in a relational database.
Foreign keys are featured by the InnoDB engine and therefore all three
tables of the database use it:
1. `friends` main table
2. `relation` deploys a simple relation between rows of the main table,
'1-2' means '1 is
Hello Andreas,
You're not telling us what version of MySQL you're using,
so I'll have to give it a shot in the dark ...
mysql SHOW CREATE TABLE friends\G
*** 1. row ***
Table: friends
Create Table: CREATE TABLE `friends` (
`id`
1) Sorry for not giving you the version:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
*mysql SELECT VERSION();
+---+
| VERSION() |
+---+
| 5.0.17-nt |
+---+*
1 row in set (0.00 sec)
2) Further, please note that the following output, of
Andreas Krüger wrote:
1) Sorry for not giving you the version:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
*mysql SELECT VERSION();
+---+
| VERSION() |
+---+
| 5.0.17-nt |
+---+*
1 row in set (0.00 sec)
snip
InnoDB Status after
Thanks Michael, that' s the problem. Syntactically my attempt was
correct. Only I had the *value '1' in the only row that table
`friends`contains, whereas table `category`was still empty*. (I was
about creating the database for sample purposes.) When I tried to create
the FOREIGN KEY out of
support from https://order.mysql.com/
- Original Message -
From: Alberto [EMAIL PROTECTED]
Newsgroups: mailing.database.myodbc
Sent: Tuesday, September 09, 2003 10:07 PM
Subject: Fw: [SQL] foreign key from a table to the *same* table
Hi to all...i've a problem...would anyone help me
Hi to all...i've a problem...would anyone help me?
I've a table called COURSES, where there are some universitary courses.
I've a table called DIDACTIC_UNITS, where there are some subjects with some
info like the professor, the course year, etc.
The problem is that some didactic units can be