>I just wanted to know whether there are any known issues in defining and
using Foreign key constraints in MySQL 4 and >MySQL 5.
>To be specific, are there any issues on using ON DELETE CASCADE and ON
UPDATE CASCADE?
>
>Would there be any performance issues when we define Foreign key
constraints?
>
Sergei,
Check out Paul DuBois' book MySQL - The Definitive Guide (2nd
edition). It has a few good chapters that discuss foreign key
constraints.
--bmansell
Brian E. Mansell
MySQL Professional
On Thu, 22 Jul 2004 13:06:07 -0700, Sergei Skarupo <[EMAIL PROTECTED]> wrote:
> Hi everyone,
>
> I'd
> > This makes perfectly sense.
> >
> > So, once again I dare to ask: what's the problem with NULLable
> > Foreign Keys? It works fine :-)
> >
> > (now, who was it that said that FKs should be entered/exist
> > always?)
> >
> > With regards,
>
> Here is the issue...
>
> If you go back to what he w
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Friday 28 May 2004 11:50 am, Martijn Tonies wrote:
> This makes perfectly sense.
>
> So, once again I dare to ask: what's the problem with NULLable
> Foreign Keys? It works fine :-)
>
> (now, who was it that said that FKs should be entered/exist
> a
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Friday 28 May 2004 11:50 am, Martijn Tonies wrote:
> This makes perfectly sense.
>
> So, once again I dare to ask: what's the problem with NULLable
> Foreign Keys? It works fine :-)
>
> (now, who was it that said that FKs should be entered/exist
> a
Hi,
> > Martijn Tonies wrote:
> >
> >> Hi Jeff,
> >>
> >
> >
> > In this example, inno3.PK_Col references inno2.Child_Col, so the 2nd and
> > 3rd statements are failing because they try to set inno3.PK_Col to
> > values not present in inno2.Child_Col. The NULLs are irrelevant.
Woops, right Mich
Michael Stassen wrote:
Martijn Tonies wrote:
Hi Jeff,
In this example, inno3.PK_Col references inno2.Child_Col, so the 2nd and
3rd statements are failing because they try to set inno3.PK_Col to
values not present in inno2.Child_Col. The NULLs are irrelevant.
Michael
Perhaps this is what you
Martijn Tonies wrote:
Hi Jeff,
CREATE TABLE inno2 (
PK_Col Integer NOT NULL DEFAULT 0,
Child_Col Integer,
PRIMARY KEY (PK_Col)
) TYPE=InnoDB ;
CREATE INDEX I_Inno2_ChildCol
ON inno2(Child_Col);
CREATE TABLE inno3 (
PK_Col Integer NOT NULL DEFAULT 0,
Child_Col Integer,
PRIMARY KEY (PK_Col)
) TYPE=I
Hi Jeff,
> > ok - I've checked.
> >
> > > > > Why not? What's wrong with this:
> > > > >
> > > > > BORROWER
> > > > > BorrowerID
> > > > >
> > > > > BOOKS
> > > > > BookID
> > > > > BorrowerID (nullable)
> > > > >
> > > > > FK from Books.BorrowerID to Borrower.BorrowerID
> > > > >
> > > > > I have
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Friday 28 May 2004 02:57 am, Martijn Tonies wrote:
> Hi,
>
> ok - I've checked.
>
> > > > Why not? What's wrong with this:
> > > >
> > > > BORROWER
> > > > BorrowerID
> > > >
> > > > BOOKS
> > > > BookID
> > > > BorrowerID (nullable)
> > > >
> > > >
Hi,
ok - I've checked.
> > > Why not? What's wrong with this:
> > >
> > > BORROWER
> > > BorrowerID
> > >
> > > BOOKS
> > > BookID
> > > BorrowerID (nullable)
> > >
> > > FK from Books.BorrowerID to Borrower.BorrowerID
> > >
> > > I haven't checked, but this _should_ be possible.
> > >
> > > With
Hi,
> > Why not? What's wrong with this:
> >
> > BORROWER
> > BorrowerID
> >
> > BOOKS
> > BookID
> > BorrowerID (nullable)
> >
> > FK from Books.BorrowerID to Borrower.BorrowerID
> >
> > I haven't checked, but this _should_ be possible.
> >
> > With regards,
>
> Its a foreign key, you can not nul
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Thursday 27 May 2004 03:00 am, Martijn Tonies wrote:
> Why not? What's wrong with this:
>
> BORROWER
> BorrowerID
>
> BOOKS
> BookID
> BorrowerID (nullable)
>
> FK from Books.BorrowerID to Borrower.BorrowerID
>
> I haven't checked, but this _should_
You could create a special "borrower" account to signify that it is not
loaned out and assign that to the book. If this is for a library system
(multiple branches) you could create one account for each branch. That way
you would know where the book is at all times, "borrowed" or not ;-)
Shaw
Hi,
> On Wednesday 26 May 2004 11:22 pm, [EMAIL PROTECTED] wrote:
> > Hi, I am trying to use the foreign key constraints from InnoDB
> > and creating indexes is a requirement for foreign key.
> > The problem is that by creating index for my foreign key,
> > it does not allow my foreign key to have
[EMAIL PROTECTED] wrote:
Hi, I am trying to use the foreign key constraints from InnoDB
and creating indexes is a requirement for foreign key.
The problem is that by creating index for my foreign key,
it does not allow my foreign key to have null or blank values which my records will have.
For eg.
[EMAIL PROTECTED] wrote:
Hi, I am trying to use the foreign key constraints from InnoDB
and creating indexes is a requirement for foreign key.
The problem is that by creating index for my foreign key,
it does not allow my foreign key to have null or blank values which my records will have.
For eg.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Wednesday 26 May 2004 11:22 pm, [EMAIL PROTECTED] wrote:
> Hi, I am trying to use the foreign key constraints from InnoDB
> and creating indexes is a requirement for foreign key.
> The problem is that by creating index for my foreign key,
> it does
In fact it seems to be just to opposite. I toggled the default values to
be null and allowed for the null option and "poof" it worked! I don't
really understand this very well. Wish I did.
>
> Some key in the table is null when it shouldnt be, or the type of the join
> keys isnt the same. i h
Some key in the table is null when it shouldnt be, or the type of the join
keys isnt the same. i have had issues when importing data from a dump so
i've had to do a FORIEGN_KEY_CHECKS=0
>
> So I have made a table called 'uid' where on uid is the only field in
> the table. Then I make another table
At 18:22 + 10/8/03, Croniser Brian Contr AFRL/IFGB wrote:
Here is the script that creates the database.
create table object_attrib (obj_record_id INTEGER(7) AUTO_INCREMENT NOT
NULL,
PRIMARY KEY (obj_record_id),
INDEX (rel_obj_int_id),
FOREIGN KEY (rel_obj_int_id)
REFERENC
maxim,
Tuesday, May 28, 2002, 4:47:13 PM, you wrote:
m> Question. I try to understand with " 4.3 Foreign key constraints "
m> InnoDB Engine in MySQL-Max-3.23.50/MySQL-4.0.1.
m> I use MySQL Max (InnoDB) 3.23.49 for Win2000
m> I have created two tables:
m> CREATE TABLE parent (id INT NOT NULL,
Hi,
Yes, you are right but be aware with the delete cascade feature, maybe in
the way?.
Regards
- Original Message -
From: Carl Schmidt <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, April 07, 2002 7:16 PM
Subject: FOREIGN KEY Constraints
> From the mysql docs, it looks like
Carl,
Monday, April 08, 2002, 3:16:26 AM, you wrote:
CS> From the mysql docs, it looks like you can only use foreign keys if your
CS> tables are type InnoDB. Is this correct?
Yes, you are right. In MyISAM tables you can use REFERENCE
clause, but it does nothing.
CS> Carl
--
For t
24 matches
Mail list logo