> Clients can be referred to by one or more names and so there's
> another table:
> 
>   CREATE TABLE client_names (
>     id integer,
>     name text
>   );
> 
> Names aren't unique. Two clients can have the same name.

But the combination of id and name are unique: hence try this:

CREATE TABLE client_names (
        id integer, 
        name text, 
        primary key (id, name))

That creates a unique index on (id, name). But you won't ever be able to
drop it. If you will be modifying your schema in future (perhaps!) you
can do:

CREATE TABLE client_names (
        id integer, 
        name text)
CREATE UNIQUE INDEX client_names_primary_key ON client_names (id, name)
        
Hugh
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to