Q: Does foreign keys affect NATURAL JOINs?
SQLite 3.6.18 sample (NO foreign keys):
CREATE TABLE t1 (a INTEGER PRIMARY KEY, b INTEGER NOT NULL);
CREATE TABLE t2 (x INTEGER PRIMARY KEY, y INTEGER NOT NULL);
SELECT * FROM a NATURAL JOIN b; -- Cartesian product!
SQLite 3.6.19 sample (using foreign keys):
CREATE TABLE t1 (a INTEGER PRIMARY KEY, b INTEGER NOT NULL);
CREATE TABLE t2 (x INTEGER PRIMARY KEY, FOREIGN KEY(y) REFERENCES t1(a) );
SELECT * FROM a NATURAL JOIN b; -- Inner join??
I haven't tested this. Does this NATURAL JOIN produce an inner join or a
cartesian product?
Anyway, I think this should be documented.
_________________________________________________________________
Hitta hetaste singlarna på MSN Dejting!
http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users