Referential Integrity

From: Stefan Ram <ram_at_zedat.fu-berlin.de>
Date: 16 Nov 2016 12:41:38 GMT
Message-ID: <integrity-20161116133954_at_ram.dialup.fu-berlin.de>



[Quoted] [Quoted]   Does the following schema have referential integrity?

\W SET sql_mode = 'ANSI,TRADITIONAL';
DROP SCHEMA S; CREATE SCHEMA S; USE S; CREATE TABLE T ( C VARCHAR ( 255 ), D VARCHAR ( 255 )); CREATE INDEX I on T ( C );

INSERT INTO T ( C, D ) VALUES ( '1', '1' ); INSERT INTO T ( C, D ) VALUES ( '1', '2' ); CREATE TABLE U

( C VARCHAR ( 255 ),
  D VARCHAR ( 255 ),
  FOREIGN KEY ( D ) REFERENCES T ( C ));

INSERT INTO U ( C, D ) VALUES ( 'A', '1' ); SELECT * FROM T; SELECT * FROM U; [Quoted]   Observe that the value of the foreign key '1' from table U   appears /twice/ in table T. Received on Wed Nov 16 2016 - 13:41:38 CET

Original text of this message