hi Keith, hi others,
> If there should only be one entry for each name (and it is not case
> sensitive),
I'm using sqlite trough a C++ program wich take care of the case
sensitive. In this very case, each entry has to be unique.
> your best bet would be to declare that NAME is unique:
>
> create table Tags
> (
> id integer primary key,
> name text collate nocase unique,
> count integer not null
> );
>
> Then when you want to insert you just do so, as in:
>
> INSERT OR IGNORE INTO TAGS (name, count) VALUES
> ('magnetohydrodynamics', 0);
>
> To increment a count you would do:
>
> INSERT OR IGNORE INTO TAGS (name, count) VALUES
> ('magnetohydrodynamics', 0); UPDATE TAGS SET count = count + 1 WHERE
> name = 'magnetohydrodynamics';
that's definitely something I want do! thanx!
but I also would like to know how can I check if an entry exists,(or not
exists), in a table. Like,
IF (exists) THEN (doSomething) END
even if the same entry is present several times I want to execute
`doSomething` only one time.
regards,
Nicolas J.