List:MySQL on Win32« Previous MessageNext Message »
From:Christian Mack Date:August 5 1999 4:35pm
Subject:Re: References problem
View as plain text  
Robert Bütof wrote:
> 
> Hi,
> 
> I used to work with Access as Backend and Frontend.
> It work well for a few months but it got to slow, so
> I decided to change the backend.
> I downloaded MySql Win32 and MyODBC.
> Installation was successfull.
> 
> My question is:
> I have got two tables: "komm" and "best"
> The pk of komm is id_komm and the pk of best is id_best.
> There is also a field in best called id_komm. And this field
> should be linked with id_komm from komm.
> So i tried the following SQL-Sting to restrict deleting a recordset
> from komm if there a linked recordsets in best:
> CREATE TABLE komm (
>         id_komm INT NOT NULL PRIMARY KEY AUTO_INCREMENT
>                         REFERENCES best (id_komm) ON DELETE RESTRICT,
> ......
> ...
> 
> This doesn't work !
> MySql isn't restricting me from deleting recordsets !
> 
> What did I do wrong ?
> 
> tnx, Robert

Hi Robert

You didn't read the manual :)

It says:
7.6 CREATE TABLE syntax
...
* The FOREIGN KEY, CHECK and REFERENCES clauses don't actually do anything. The syntax for
them is provided only for compatibility, to make it easier to port code from other SQL
servers and to run applications that create tables with references. See
section 5.3 Functionality missing from MySQL.
...

Tschau
Christian

Thread
References problemRobert B├╝tof5 Aug
  • Re: References problemChristian Mack5 Aug