Re: [sqlite] UNIQUE PRIMARY KEY on TEXT column?

2010-09-17 Thread Nicolas Williams
On Fri, Sep 17, 2010 at 02:02:44PM -0400, Igor Tandetnik wrote: > Keith Roberts wrote: > > I think what I really mean is I want a text column with only > > one unique value, that is also indexed. > > UNIQUE constraint will do just that. > > > Also ,I guess the INTEGER

Re: [sqlite] UNIQUE PRIMARY KEY on TEXT column?

2010-09-17 Thread Keith Roberts
On Fri, 17 Sep 2010, Roger Andersson wrote: > To: 'General Discussion of SQLite Database' <sqlite-users@sqlite.org> > From: Roger Andersson <r...@telia.com> > Subject: Re: [sqlite] UNIQUE PRIMARY KEY on TEXT column? > >> I'm getting there now ;

Re: [sqlite] UNIQUE PRIMARY KEY on TEXT column?

2010-09-17 Thread Roger Andersson
> I'm getting there now ;) > > Keith I don't know if this will be of any help but you can do something like UPDATE file_downloads set dl_count = dl_count + 1 where filename = "$dl_file"; /Roger ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] UNIQUE PRIMARY KEY on TEXT column?

2010-09-17 Thread Keith Roberts
On Fri, 17 Sep 2010, Igor Tandetnik wrote: > To: sqlite-users@sqlite.org > From: Igor Tandetnik <itandet...@mvps.org> > Subject: Re: [sqlite] UNIQUE PRIMARY KEY on TEXT column? > > Keith Roberts <ke...@karsites.net> wrote: >> I think what I really mean is I wa

Re: [sqlite] UNIQUE PRIMARY KEY on TEXT column?

2010-09-17 Thread Igor Tandetnik
Keith Roberts wrote: > I think what I really mean is I want a text column with only > one unique value, that is also indexed. UNIQUE constraint will do just that. > Also ,I guess the INTEGER PRIMARY KEY column is worth > keeping in the table, as a matter of course? Usually,

Re: [sqlite] UNIQUE PRIMARY KEY on TEXT column?

2010-09-17 Thread Keith Roberts
On Fri, 17 Sep 2010, O'Neill, Owen wrote: > To: General Discussion of SQLite Database <sqlite-users@sqlite.org> > From: "O'Neill, Owen" <oone...@averyberkel.com> > Subject: Re: [sqlite] UNIQUE PRIMARY KEY on TEXT column? > > > Hi Keith, > &

Re: [sqlite] UNIQUE PRIMARY KEY on TEXT column?

2010-09-17 Thread Keith Roberts
On Fri, 17 Sep 2010, Igor Tandetnik wrote: > To: sqlite-users@sqlite.org > From: Igor Tandetnik <itandet...@mvps.org> > Subject: Re: [sqlite] UNIQUE PRIMARY KEY on TEXT column? > > Keith Roberts <ke...@karsites.net> wrote: >> I have the following table to keep

Re: [sqlite] UNIQUE PRIMARY KEY on TEXT column?

2010-09-17 Thread O'Neill, Owen
Hi Keith, Depending on your definition of 'efficient' then this might do what you want. (untested - might need to add or remove bracket since sqlite does seem fussy about having what it considers to be extra ones) INSERT OR REPLACE INTO "file_downloads" SELECT COALESCE( (SELECT

Re: [sqlite] UNIQUE PRIMARY KEY on TEXT column?

2010-09-17 Thread Igor Tandetnik
Keith Roberts wrote: > I have the following table to keep a count of the number of > times files are downloaded from my website: > > CREATE TABLE "file_downloads" > ( > "record_id" INTEGER PRIMARY KEY, > "filename" char(60), > "dl_count" INTEGER > /* PRIMARY KEY