Ivan Shmakov <[email protected]> wrote:
> Well, this case is somewhat weird. I have a number of tables
> like:
>
> PRAGMA "foreign_keys" = 1;
>
> CREATE TABLE "foo-L" (
> key INTEGER PRIMARY KEY
> REFERENCES "foo" (key),
> value INTEGER NOT NULL);
>
> Which are tied to a single table, like:
>
> CREATE TABLE "foo" (
> key INTEGER PRIMARY KEY,
> value INTEGER NOT NULL);
>
> This structure is, obviously, could just as well be represented
> with, e. g.:
>
> CREATE TABLE "foo" (
> "key" INTEGER PRIMARY KEY,
> "value" INTEGER NOT NULL,
> "value-1" INTEGER,
> …
> "value-N" INTEGER);
Or else with this:
CREATE TABLE "foo" (
key INTEGER PRIMARY KEY,
value INTEGER NOT NULL);
create table fooDetails(
key INTEGER PRIMARY KEY
REFERENCES "foo" (key),
L integer not null,
value integer not null);
That's what a fully normalized schema would look like for your data.
--
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users