Re: rowid as foreign key

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re: rowid as foreign key

Gwendal Roué-2

> Le 24 juil. 2017 à 20:58, Roman Fleysher <[hidden email]> a écrit :
> Dear SQLiters,
> Is it possible to link two tables using rowid, the implicit column? I tried and it did not work, so I presume the answer to my question is "no".

Hello Roman,

The answer is yes. For example :

$ sqlite3 /tmp/db.sqlite
sqlite> CREATE TABLE foo (c);
sqlite> CREATE TABLE bar (c);
sqlite> INSERT INTO foo (c) VALUES ('foo');
sqlite> INSERT INTO bar (c) VALUES ('bar');
sqlite> SELECT foo.rowid, foo.c, bar.rowid, bar.c FROM foo, bar WHERE foo.rowid = bar.rowid;

Gwendal Roué

sqlite-users mailing list
[hidden email]