vl.pavlov wrote:
> hello & thanks 4 reply
>
> ok, i think i understand,
> i would like that you, if not prob., write the whole solution once with
> index on words
>
Here it is again.
create table words (word text primary key, number integer);
insert or replace into words values(:word,
coalesce((select number from words where word = :word) + 1, 1));
I have changed the field name above from the original count to number to
avoid confusion with the count() function in SQL.
The primary key constraint on the word column creates a unique index on
the words with the word field in ascending order. That index is used to
quickly locate a word in the table, or determine that the word is
missing from the table.
The :word is a parameter to the insert statement that you bind to the
word you want to insert. If you are generating the SQL as text then
simply replace that identifier with a literal string containing the word
to be inserted.
HTH
Dennis Cote
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users