Ian Hardingham <[email protected]> wrote:
> I have this table:
>
> tournamentParticipantTable
>
> id INTEGER PRIMARY KEY
> user INTEGER
> tournamentId INTEGER
>
> I'm obviously going to put an index on both user, tournamentId and
> tournamentId, user
If you have one on (tournamentId, user), you don't also need one on
tournamentId. If you have a phonebook sorted by (last name, first name), you
could use it to find all people with a given last name - you don't need a
separate book for that.
> but as the relation is unique, I was wondering if I
> could in some way let SQLite know that?
create unique index ...
> Also... it does seem weird that id is the primary key when I'll never
> actually use it.
Then make it
create table tournamentParticipantTable (
user INTEGER,
tournamentId INTEGER,
primary key (tournamentId, user)
);
--
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users