On Thu, Nov 19, 2009 at 9:34 PM, Ye Yuan yuan4...@gmail.com wrote:
Hi Victor,
It looks to me the foreign key syntax is wrong. Can you create the
Relationship table on your database by using below ddl?
create table if not exists Relationship
(ID integer auto_increment primary key,
Parent
Hi;
I don't claim to be an expert in MySQL. The following code was largely
supplied to me by someone who was. I don't really understand foreign keys.
He wrote this off the top of his head, and it's throwing an error. Here's
the python code:
def catTree():
user, passwd, db, host = login
for the (errno: 150) message.
Regards,
Gavin Towey
-Original Message-
From: wabiko.takuma [mailto:wab...@sysrdc.ns-sol.co.jp]
Sent: Friday, August 14, 2009 3:35 AM
To: mysql@lists.mysql.com
Subject: foreign keys: Cannot create InnoDB table
Hi, All,
I can't create InnoDB table
Hi,
I can't create InnoDB table with foreign key constraints using more than 3
colmuns.
When I create table `test_fk`.`tbl1`, it gives me:
Can't create table 'test_fk.tbl1' (errno: 150)
why? CREATE TABLE syntax looks perfectly right to me.
Any suggestions are welcome.
Thank you,
wabi
Hi, All,
I can't create InnoDB table with foreign key constraints using more than 3
colmuns.
When I create table `test_fk`.`tbl1`, it gives me:
Can't create table 'test_fk.tbl1' (errno: 150)
why? CREATE TABLE syntax looks perfectly right to me.
Any suggestions are welcome.
Thank you,
@lists.mysql.com
Subject: foreign keys: Cannot create InnoDB table
Hi, All,
I can't create InnoDB table with foreign key constraints using more than 3
colmuns.
When I create table `test_fk`.`tbl1`, it gives me:
Can't create table 'test_fk.tbl1' (errno: 150)
why? CREATE TABLE syntax looks
Does using foreign keys simply enforce referential integrity OR can it also
speed up JOIN queries?
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Indexes speed up joins. Foreign keys should be indexes themselves, so they
can also speed up joins. If the FK is not an index, it won't help. So,
index your FKs
On Wed, Oct 8, 2008 at 10:43 AM, Ben A.H. [EMAIL PROTECTED] wrote:
Does using foreign keys simply enforce referential integrity
. Foreign keys should be indexes themselves, so
they
can also speed up joins. If the FK is not an index, it won't help. So,
index your FKs
On Wed, Oct 8, 2008 at 10:43 AM, Ben A.H. [EMAIL PROTECTED] wrote:
Does using foreign keys simply enforce referential integrity OR can it
also
speed
in the same table usually dealt with
in terms of design? Implementation?
ThanX,
Ben
Jim Lyons [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Indexes speed up joins. Foreign keys should be indexes themselves, so
they
can also speed up joins. If the FK is not an index
Programmer / Analyst
_
From: Arthur Fuller [mailto:[EMAIL PROTECTED]
Sent: October 8, 2008 2:55 PM
To: Ben A.H.
Cc: mysql@lists.mysql.com
Subject: Re: Foreign Keys
So you are talking about parent-child relationships in a single table, or in
the technical jargon reflexive
:* Arthur Fuller [mailto:[EMAIL PROTECTED]
*Sent:* October 8, 2008 2:55 PM
*To:* Ben A.H.
*Cc:* mysql@lists.mysql.com
*Subject:* Re: Foreign Keys
So you are talking about parent-child relationships in a single table,
or in the technical jargon reflexive relationships. See
www.artfulsoftware.com http
On Wed, Oct 8, 2008 at 11:56 AM, Jim Lyons [EMAIL PROTECTED] wrote:
Indexes speed up joins. Foreign keys should be indexes themselves, so they
can also speed up joins. If the FK is not an index, it won't help. So,
index your FKs
If you add a FOREIGN KEY constraint in MySQL 5+ it adds
.
Foreign keys (aka referential integrity) has a different purpose:
Cross-table (or inter-table) consistency.
If one table refers to (the primary key of) another table, it should be
guaranteed that this reference is an existing value (does point to an
existing record).
If there were no target record
massive
insert into the parent table and include all related columns and somehow
magically all field and relational keys fall into place.
AFAIK, this isn't possible.
Foreign keys (aka referential integrity) has a different purpose:
Cross-table (or inter-table) consistency.
If one table
relationships I can just do one
massive
insert into the parent table and include all related columns and somehow
magically all field and relational keys fall into place.
AFAIK, this isn't possible.
Foreign keys (aka referential integrity) has a different purpose:
Cross-table (or inter
I am hoping for a little clarification/education here. My understanding of
how foreign keys work is very minimal.
In using MySQL for the last several years as a backend to web apps I have
always managed relationships amongst the tables with auto increment primary
keys myself.
I have a new
Hi Yves,
I have a problem with my foreign keys. I have the following two tables:
CREATE TABLE keylist (
KeylistId INTEGER NOT NULL,
UserId INTEGER NOT NULL,
PRIMARY KEY (KeylistId, UserId));
CREATE TABLE user (
UserId INTEGER NOT NULL PRIMARY KEY,
AdditionalKeylist
On 04.11.2007 21:10 CE(S)T, Martijn Tonies wrote:
Now I have added this foreign key constraint:
ALTER TABLE user ADD FOREIGN KEY (AdditionalKeylist) REFERENCES
keylist (KeylistId) ON DELETE SET NULL;
This cannot work. The column in KEYLIST to which you are
pointing should have a unique
Hi,
I have a problem with my foreign keys. I have the following two tables:
CREATE TABLE keylist (
KeylistId INTEGER NOT NULL,
UserId INTEGER NOT NULL,
PRIMARY KEY (KeylistId, UserId));
CREATE TABLE user (
UserId INTEGER NOT NULL PRIMARY KEY,
AdditionalKeylist INTEGER
more and found out that PostgreSQL also forbids
foreign keys referencing non-unique columns (like in SQL92) due to
serious bugs in the past, which is one more reason why I don't want to
keep it this way. (The whole thing should be somewhat portable...)
--
Yves Goergen LonelyPixel [EMAIL PROTECTED
Hi:
Below is the following relevant create table syntax
CREATE Table providers(
[snipped]
FOREIGN KEY (status) REFERENCES provider_status(ID,title),
UNIQUE KEY ID (ID)
) TYPE=MyISAM;
and below is the relevant output from a describe query:
mysql show columns from providers;
SHOW CREATE TABLE providers\G
- Original Message -
From: Tim Johnson [EMAIL PROTECTED]
To: MySQL General Mailing List mysql@lists.mysql.com
Sent: Wednesday, February 21, 2007 2:59:35 AM (GMT-0500) Auto-Detected
Subject: Retrieving foreign keys and references
Hi:
Below is the following
On Wednesday 21 February 2007 17:01, Rolando Edwards wrote:
SHOW CREATE TABLE providers\G
Hi Rolando:
That doesn't do it on my machine (linux, ver 4.0.2)
Here's what I see
mysql SHOW CREATE TABLE providers\G
*** 1. row ***
Table: providers
SHOW INDEXES FROM `providers`;
By the way, what version of MySQL are you using ???
- Original Message -
From: Tim Johnson [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Sent: Wednesday, February 21, 2007 3:35:46 AM (GMT-0500) Auto-Detected
Subject: Re: Retrieving foreign keys and references
Hi Tim,
Foreign key definitions are parsed but ignored by MyISAM tables.
Try InnoDB or PBXT (http://www.primebase.com/xt) :)
On Feb 21, 2007, at 9:35 AM, Tim Johnson wrote:
On Wednesday 21 February 2007 17:01, Rolando Edwards wrote:
SHOW CREATE TABLE providers\G
Hi Rolando:
That doesn't
On Wednesday 21 February 2007 17:43, Rolando Edwards wrote:
SHOW INDEXES FROM `providers`;
By the way, what version of MySQL are you using ???
4.0.20
--
Tim Johnson [EMAIL PROTECTED]
Palmer, Alaska, USA
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To
On Wednesday 21 February 2007 17:51, Paul McCullagh wrote:
Hi Tim,
Hello Paul
Foreign key definitions are parsed but ignored by MyISAM tables.
Understood. Thanks
Try InnoDB or PBXT (http://www.primebase.com/xt) :)
for the time being, I'm going to stick with MyISAM. I've
got a possible
Nico Rittner wrote:
Hi Frank
what I meant was: are you sure that the tables which are in your database
are defined correctly, i.e. have the actions?
Yes, if i try to delete or update a record which is referenced by another
i get mysql error #1217 , which should be correct.
might have
`), )
ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='groups';
As you can see, the foreign keys - statements are included,
but without the 'action parts' ( on update,on delete );
thanks,
Nico
Hi Nico,
not sure what is going on here. In a simple test I did, everything was fine
as yo can see below
Hallo,
Sorry to ask this questions, but are you confident that the action clauses
work properly, i.e. the tables were created correctly?
In the case of a crash i need to restore the dump including
the on delete/update clauses.
What do you see when you execute show create table groups?
Nico Rittner wrote:
Hallo,
Sorry to ask this questions, but are you confident that the action
clauses work properly, i.e. the tables were created correctly?
In the case of a crash i need to restore the dump including
the on delete/update clauses.
What do you see when you execute show
Hi Frank
what I meant was: are you sure that the tables which are in your database
are defined correctly, i.e. have the actions?
Yes, if i try to delete or update a record which is referenced by another
i get mysql error #1217 , which should be correct.
might have been lost somewhere. Can
,
Nico
Hi Nico,
are you using the InnoDB storage engine for your tables?
If not, the clauses will not be included in the dump, as only InnoDB
supports foreign keys.
When you create a non-InnoDB table which has a foreign key specification,
MySQL just ignores the specification.
Cheers
Frank
--
MySQL
';
As you can see, the foreign keys - statements are included,
but without the 'action parts' ( on update,on delete );
thanks,
Nico
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
hello,
does anybody now how mysqldump handles the actions
for 'on delete' and 'on update' ? In my Version 4.1.14
the action clauses are missing. When reimporting the
dump, how does mysql know about the 'action' when altering
the table with forein keys.
Thanks,
Nico
--
MySQL General Mailing
That's the whole question.
Do foreign keys (FKs) affect query speed?
'Course the answer could lead to sub-questions grin /, e.g.,
If so, how best to optimize a query for them?
And I guess a corollary question would be whether implementing FKs slows down
MySQL processing in general
That's the whole question.
Do foreign keys (FKs) affect query speed?
'Course the answer could lead to sub-questions grin /, e.g.,
If so, how best to optimize a query for them?
And I guess a corollary question would be whether implementing FKs slows down
MySQL processing in general
Hello everybody.
I'm using php 4.4 and mysql 5.0 and i'm having the bellow issue:
I've a group table and a system table, bellow this i have a group_system
table that has a foreign key to group table and to system table. When a
tried to delete one register in the group_system table, it gives me
I had that problem as well and a quick search revealed this:
A) Whole databases are not handled by InnoDB. The individual tables are.
Check the results of SHOW CREATE TABLE table_name_here for each table
you are linking from and linking to. You should see ENGINE = InnoDB after
the last ) but
In theory, theory and practice are the same;
in practice they are not.
On Mon, 20 Mar 2006, Martijn Tonies wrote:
To: mysql@lists.mysql.com
From: Martijn Tonies [EMAIL PROTECTED]
Subject: Re: Discussion: the efficiency in using foreign keys
Hi,
This is a fundamental concept in RDBMS
and 1025 - but not foreign keys
I got an error 1025 trying to rename an InnoDB table. When I go to
look in the database now, that table isn't there even though there is
a .ibd file in the mysql data directory with the target name. If I
try to create a table with the target name (as an InnoDB table), I
I've always been a believer in avoiding sql procedures, for the main
reason that I want to be as database-independent as possible. I know it
is less efficient, but being able to switch between MySQL, Postgre, and
the new freebies from IBM, Oracle, and Microsoft is a strong advantage
from the
Hi all,
This is a fundamental concept in RDBMS: the use of foreign keys in
database design.
I'd just like to poll the community here, on whether it is a best
practice, or practically essential to 'link' related tables by use of
foreign keys.
For myself, I usually do all the validity
are picked from
the quiz_question and quiz_answer tables, using the foreign
keys in the result table.
I find it helps me to think of foreign keys as unique
pointers to rows in other related tables.
HTH
Keith
In theory, theory and practice are the same;
in practice they are not.
On Mon, 20
Hello Keith,
Thanks for responding. I was actually referring to the subject of using
foreign keys, as opposed to leaving it to the calling application to do
the necessary checks. In particular issues of performance, efficiency
etc. IMHO, foreign keys add 'strictness' to the consistency
Hi,
This is a fundamental concept in RDBMS: the use of foreign keys in
database design.
I'd just like to poll the community here, on whether it is a best
practice, or practically essential to 'link' related tables by use of
foreign keys.
For myself, I usually do all the validity
David,
- Original Message -
From: David Felio [EMAIL PROTECTED]
Newsgroups: mailing.database.myodbc
Sent: Thursday, March 16, 2006 11:31 PM
Subject: Errors 1005 and 1025 - but not foreign keys
I got an error 1025 trying to rename an InnoDB table. When I go to
look in the database
can create it as MyISAM, however. If I try to then
convert that MyISAM table to InnoDB, I get the 1025 error. I tried
removing the .ibd file from the mysql data dir and that did not help.
In googling the error, it seems all solutions revolve around foreign
keys, but there are no foreign keys
[mailto:[EMAIL PROTECTED]
Enviado el: Viernes, 10 de Marzo de 2006 01:35 p.m.
Para: mysql@lists.mysql.com
Asunto: FOREIGN KEYS
Hi!
Server system SBS (Novell Small Business suite) 6.5 sp 1 with MySQL
ver.
4.0.15a, PHP 4.2.3, all of them on same machine.
I just finished create a new DB called TIULIM
Hi!
Server system SBS (Novell Small Business suite) 6.5 sp 1 with MySQL
ver. 4.0.15a, PHP 4.2.3, all of them on same machine.
I just finished create a new DB called TIULIM (InnoDB) with 3 tables
(Sites, Tracks Pathes).
Now, using MySQL Query Browser ver. 1.1.15, I'm trying to build FOREIGN
).
Now, using MySQL Query Browser ver. 1.1.15, I'm trying to build FOREIGN
KEYS.
The above tool is generating the following query:
ALTER TABLE `tiulim`.`pathes` ADD CONSTRAINT `FK_pathes_1` FOREIGN KEY
`FK_pathes_1` (`Site_ID`)
REFERENCES `sites` (`Site_ID`)
ON DELETE RESTRICT
p.m.
Para: mysql@lists.mysql.com
Asunto: FOREIGN KEYS
Hi!
Server system SBS (Novell Small Business suite) 6.5 sp 1 with MySQL ver.
4.0.15a, PHP 4.2.3, all of them on same machine.
I just finished create a new DB called TIULIM (InnoDB) with 3 tables (Sites,
Tracks Pathes).
Now, using MySQL
I'm experimenting with Foreign Keys to maintain referential integrity. I
have just added a Foreign Key to one of my tables, but now when I attempt to
add a new record, I get this error:
#23000Cannot add or update a child row: a foreign key constraint fails
(`fccamp/families`, CONSTRAINT
Jesse [EMAIL PROTECTED] wrote on 12/22/2005 05:09:12 PM:
I'm experimenting with Foreign Keys to maintain referential integrity. I
have just added a Foreign Key to one of my tables, but now when I
attempt to
add a new record, I get this error:
#23000Cannot add or update a child row
I am trying to maintain one master list of countries and the states
within those countries. I'd like to keep this info in a common
database, to be used by 2 or three other databases on the same host,
using foreign keys to make sure that all the country/state data matches
up to the master list
to keep this info in a common
database, to be used by 2 or three other databases on the same host,
using foreign keys to make sure that all the country/state data matches
up to the master list.
If I can't use foreign keys, should I just run regular updates to sync
the data between duplicate tables
countries. I'd like to keep this info in a common
database, to be used by 2 or three other databases on the same host,
using foreign keys to make sure that all the country/state data matches
up to the master list.
If I can't use foreign keys, should I just run regular updates to sync
the data
and the states
within those countries. I'd like to keep this info in a common
database, to be used by 2 or three other databases on the same host,
using foreign keys to make sure that all the country/state data
matches
up to the master list.
If I can't use foreign keys, should I just run regular updates
of countries and the states
within those countries. I'd like to keep this info in a common
database, to be used by 2 or three other databases on the same host,
using foreign keys to make sure that all the country/state data
matches
up to the master list.
If I can't use foreign keys, should I just run
--- Kishore Jalleda [EMAIL PROTECTED] wrote:
check the permissions on the mysql data dir, may be
the user mysql or
who ever runs mysql does not have sufficient
privileges
Kishore Jalleda
I agree with Kishore, to elaborate his answer a little
longer I would ask the following.
- is
ps, I meant to delete the note from my draft
folder... sorry
Enrique Sanchez.
Enrique Sanchez Vela
email: [EMAIL PROTECTED]
-
It's often easier to fight for one's ||We live in the outer space
field, somebody know
a way to get the
foreign keys ?
Operator [EMAIL PROTECTED] wrote:
--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
__ ___ ___ __
/ |/ /_ __/ __/ __ \/ /Gleb
HI everybody
I'm tryng to find a way to know if a field is a foreign key, by example if I
run this
describe tablename;
in the Key colum I got PRI for the primary key field, somebody know a way
to get the foreign keys ?
Regards
Daniel
To: mysql@lists.mysql.com
Subject: how to list foreign keys
HI everybody
I'm tryng to find a way to know if a field is a foreign key, by example
if I run this
describe tablename;
in the Key colum I got PRI for the primary key field, somebody know
a way to get the foreign keys
Is there a way to have foreign keys and force referential integrity? I have
a main table and a lookup table, i want to be able to require that the main
table is using values from the lookup table. I am just not sure how in
MySQL. Thanks
Nick Hird [EMAIL PROTECTED] wrote on 09/29/2005 05:03:53 PM:
Is there a way to have foreign keys and force referential integrity? I
have
a main table and a lookup table, i want to be able to require that the
main
table is using values from the lookup table. I am just not sure how in
MySQL
Greetings.
I've just hit an interesting problem. Luckily I don't actually *need* to
restore from a backup right now - I'm just trying to create a database
dump to submit an unrelated bug report.
Anyway ...
I'm using the command:
mysqldump -K DATABASE_NAME db.sql -p
However when I create
Daniel Kasak wrote:
Greetings.
I've just hit an interesting problem. Luckily I don't actually *need* to
restore from a backup right now - I'm just trying to create a database
dump to submit an unrelated bug report.
Anyway ...
I'm using the command:
mysqldump -K DATABASE_NAME db.sql -p
i think you can use -K on your mysqldump and it'll put the hints in there
for the mysql command to use as well
- Original Message -
From: Daniel Kasak [EMAIL PROTECTED]
To: mysql@lists.mysql.com
Sent: Thursday, September 29, 2005 7:45 PM
Subject: Backup / Restore database with foreign
Michael Stassen wrote:
Before loading the file,
SET FOREIGN_KEY_CHECKS = 0;
after loading the file,
SET FOREIGN_KEY_CHECKS = 1;
That's it! Thanks :)
Even better, upgrade to a newer mysql (4.1.1+), where they are
automatically added to the dump file for you.
Not until the client
Hello.
I don't know the date you're asking about. However, you can
implement the FKs' features using stored procedures in MySQL 5.0.
For a small example have a look at the nice article about stored
procedures:
http://dev.mysql.com/tech-resources/articles/mysql-storedprocedures.html
I don't know the date you're asking about. However, you can
implement the FKs' features using stored procedures in MySQL 5.0.
For a small example have a look at the nice article about stored
procedures:
http://dev.mysql.com/tech-resources/articles/mysql-storedprocedures.html
Hmmm... given
Hi,
The documentation says At a later stage, foreign key constraints
will be implemented for MyISAM tables as well. Does anybody know
what is the timescale?
thanks,
Jacek
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
On Sep 23, 2005, at 12:27 PM, Jacek Becla wrote:
Hi,
The documentation says At a later stage, foreign key constraints
will be implemented for MyISAM tables as well. Does anybody know
what is the timescale?
I'm not sure there is a timescale.. I think it might be pretty open
ended. You
I would like to use separate databases to group certain related tables
to keep things clean, but I would also like to use foreign keys to
enforce referential integrity between tables in different databases. I
don't think this is possible. Am I right? And if so, am I reduced to
using carefully
Hello Jake,
I would like to use separate databases to group certain related tables
to keep things clean, but I would also like to use foreign keys to
enforce referential integrity between tables in different databases. I
don't think this is possible. Am I right? And if so, am I reduced
: need help with foreign keys, new to mysql
Sorry to reply to my own message, but I meant to add that you can read about
defining foreign key constrints in the manual
http://dev.mysql.com/doc/mysql/en/innodb-foreign-key-constraints.html.
[jg.] thanks, this is what I originally based my command off
On Wed, 2005-08-24 at 06:11 -0500, John Gonzales wrote:
CREATE TABLE `journal` (
`journal_id` int(10) unsigned NOT NULL auto_increment,
`journal_category` int(10) unsigned NOT NULL default '1',
`journal_datetime_created` timestamp NOT NULL default CURRENT_TIMESTAMP,
Pat Adams wrote:
On Wed, 2005-08-24 at 06:11 -0500, John Gonzales wrote:
CREATE TABLE `journal` (
`journal_id` int(10) unsigned NOT NULL auto_increment,
[snip]
CREATE TABLE comments
(
comment_id INT,
comment_journal_id INT,
INDEX jrn_id (journal_id),
Here you are defining an index
Wow, thanks both of you. It worked... =)
-Original Message-
From: Roger Baklund [mailto:[EMAIL PROTECTED]
Sent: August 24, 2005 9:17 AM
To: mysql@lists.mysql.com
Cc: [EMAIL PROTECTED]
Subject: Re: need help with foreign keys, new to mysql
Pat Adams wrote:
On Wed, 2005-08-24 at 06:11
i am logged in as root
-JG.
-Original Message-
From: Kishore Jalleda [mailto:[EMAIL PROTECTED]
Sent: August 19, 2005 10:35 PM
To: John Gonzales
Cc: mysql@lists.mysql.com
Subject: Re: need help with foreign keys, new to mysql
check the permissions on the mysql data dir, may be the user
help with foreign keys, new to mysql
check the permissions on the mysql data dir, may be the user mysql or
who ever runs mysql does not have sufficient privileges
Kishore Jalleda
On 8/19/05, John Gonzales [EMAIL PROTECTED] wrote:
i am creating my own little blog and i am trying to create
honestly... i don't even know. =( i'm new to mysql...
how would i check?
-jg
-Original Message-
From: Jasper Bryant-Greene [mailto:[EMAIL PROTECTED]
Sent: August 20, 2005 2:18 AM
To: mysql@lists.mysql.com
Subject: Re: need help with foreign keys, new to mysql
Yes but is the MySQL
Le vendredi 19 août 2005 à 21:09 -0500, John Gonzales a écrit :
Hi John,
#1005 - Can't create table '.\mydatabase\comments.frm' (errno: 150)
I've seen this error before.
now before i go and do something stupid, i thought i might ask for some help
on this issue :D both my blog and
.
-Original Message-
From: Thurgood Alex [mailto:[EMAIL PROTECTED]
Sent: August 20, 2005 3:22 AM
To: John Gonzales
Cc: mysql@lists.mysql.com
Subject: Re: need help with foreign keys, new to mysql
Le vendredi 19 août 2005 à 21:09 -0500, John Gonzales a écrit :
Hi John,
#1005 - Can't create table
' (errno: 150)
You can look up what error numbers mean with perror:
~: perror 150
MySQL error code 150: Foreign key constraint is incorrectly formed
i orginally created the comments table before i read about FOREIGN KEYS, so
i tried executing the following command:
ALTER TABLE comments
ADD
Sorry to reply to my own message, but I meant to add that you can read about
defining foreign key constrints in the manual
http://dev.mysql.com/doc/mysql/en/innodb-foreign-key-constraints.html.
Michael
Michael Stassen wrote:
There are a few possibilities here:
1. Both tables must be InnoDb.
orginally created the comments table before i read about FOREIGN KEYS, so
i tried executing the following command:
ALTER TABLE comments
ADD FOREIGN KEY(comment_journal_id)
REFERENCES journal(journal_id)
ON DELETE CASCADE ON UPDATE CASCADE;
which resulted with the same error as listed above. so
of my blog table as a foreign key. i've tried the
only two ways that i know how and both ways yielded the same error:
#1005 - Can't create table '.\mydatabase\comments.frm' (errno: 150)
i orginally created the comments table before i read about FOREIGN KEYS, so
i tried executing
I am having trouble with this small bit of sql I am using for a
homepage.
I need to select information on the next two events from two
separate tables; tblevents (which holds event related info), and
tbleventdate (which holds info related to each date, including times and
I am having trouble with this small bit of sql I am using for a
homepage.
I need to select information on the next two events from two
separate tables; tblevents (which holds event related info), and
tbleventdate (which holds info related to each date, including times and
Is it good practice to have a primary key for a table even though the
table has a foreign key that is the primary key of another table? If so,
why is this the case? I would appreciate if you point me to some resources
that point out the advantages and disadvantages of both approaches. Thank
you.
As a follow up to my question, I did want to mention that the foreign key
I am using is unique.
- Asad
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
If your FK really is unique, you don't need two tables. Example
First table Second Table
ID FK
1 1
2 2
3 3
...
So you can make this one table. On other words, it would be a one-to-one
relation. And this would be one table. Only with a
Hello. I appreciate your input. To clarify, I will provide you with an
example:
I have a table called business and another one called food_business. The
field business_id is a primary key of table business and a foreign key of
table food_business. In this case, the foreign key is unique and
@lists.mysql.com
Subject: Re: Primary and Foreign Keys (Follow Up)
Hello. I appreciate your input. To clarify, I will provide you with an
example:
I have a table called business and another one called
food_business. The
field business_id is a primary key of table business and a
foreign key of
table
My understanding is that RESTRICT and NO ACTION share the same behavior.
http://dev.mysql.com/doc/mysql/en/innodb-foreign-key-constraints.html
*
|NO ACTION|: In |ANSI SQL-92| standard, |NO ACTION| means /no
action/ in the sense that an attempt to delete or update a primary
I have some problem with Foreign Key settings. I use MySQL 4.12, MySQL Query
Browser 4.16 and Windows XP. Restrict and Cascade is Ok but when I try to set
No action it wont work. Sometimes there is no error message and it seams that
the change is saved. But when I check there is no changes.
in alphabetic order, including the
table create statements. The problem is that if foreign keys exist on
the tables, the reload will not work unless the backup file is hand
edited to insure that tables depended upon are created first. Is there a
way around this? If not, shouldn't the tables
1 - 100 of 445 matches
Mail list logo