Hi all,

I'm fairly new to SQLite and loving it, thanks to Mr. Hipp and everyone
else who makes it happen. My previous database experience is all in
Oracle, but I hope you won't hold that against me. ;-)

I need to create a table to link two tables that look somewhat like
this:

CREATE TABLE t1
(
  sha1 VARCHAR(40) NOT NULL PRIMARY KEY,
  --- ...
  --- other stuff
);

CREATE TABLE t2
(
  sha1 VARCHAR(40) NOT NULL PRIMARY KEY,
  --- ...
  --- other stuff
);

I need to link these two with items in a one to many relationship from
t2 back to t1. The obvious way to do it would be:

CREATE TABLE t2_t1_link
(
  t2_sha1 VARCHAR(40) NOT NULL REFERENCES t2(sha1),
  t1_sha1 VARCHAR(40) NOT NULL REFERENCES t1(sha1)
);

(By the way, I understand that these fk references don't work, but I'd
like to have them there as descriptive.)
 
This is fine, but I'd like to use something smaller, i.e. the rowid. I
understand that if I .dump the tables, the rowid's will change. Is it
possible to force them to be the same, for example, by doing something
like this (forgive errors, I hope you get the idea):

SELECT 'INSERT INTO t1 (rowid, sha1) VALUES (' ||
                        rowid || ',' || sha1 || ')' FROM t1;
....
Same for t2.

And then running those into another database? If not, any other ideas?

Thanks,
Stephen


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to