Re: [sqlite] ADD UNIQUE CONSTRAINT

2010-10-10 Thread Fadhel Al-Hashim
Thank you,

I was wondering about adding a new constraint to an existing column that is
currently holding data.

On Sun, Oct 10, 2010 at 10:54 AM, P Kishor <punk.k...@gmail.com> wrote:

> On Sun, Oct 10, 2010 at 2:45 AM, Fadhel Al-Hashim <fad...@gmail.com>
> wrote:
> > Good day,
> >
> > is it possible to Alter a table and add a unique constraint on one or
> more
> > columns?
> >
>
> See http://www.sqlite.org/lang_altertable.html
>
> In particular --
>
> "The ADD COLUMN syntax is used to add a new column to an existing
> table. The new column is always appended to the end of the list of
> existing columns. The column-def rule defines the characteristics of
> the new column. The new column may take any of the forms permissible
> in a CREATE TABLE statement, with the following restrictions:
>
> The column may not have a PRIMARY KEY or UNIQUE constraint.
> The column may not have a default value of CURRENT_TIME, CURRENT_DATE,
> CURRENT_TIMESTAMP, or an expression in parentheses.
> If a NOT NULL constraint is specified, then the column must have a
> default value other than NULL.
> If foreign key constraints are enabled and a column with a REFERENCES
> clause is added, the column must have a default value of NULL.
> Note also that when adding a CHECK constraint, the CHECK constraint is
> not tested against preexisting rows of the table. This can result in a
> table that contains data that is in violation of the CHECK constraint.
> Future versions of SQLite might change to validate CHECK constraints
> as they are added."
>
> > thanks,
> >
> > fadhel
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
>
>
>
> --
> Puneet Kishor http://www.punkish.org
> Carbon Model http://carbonmodel.org
> Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
> Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
> Nelson Institute, UW-Madison http://www.nelson.wisc.edu
> ---
> Assertions are politics; backing up assertions with evidence is science
> ===
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] ADD UNIQUE CONSTRAINT

2010-10-10 Thread Fadhel Al-Hashim
Good day,

is it possible to Alter a table and add a unique constraint on one or more
columns?

thanks,

fadhel
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Delete from A what is not in B

2010-10-04 Thread Fadhel Al-Hashim
yes  PRIMARY KEY (x,y,z)

On Sat, Oct 2, 2010 at 9:10 PM, Simon Slavin <slav...@bigfraud.org> wrote:

>
> On 2 Oct 2010, at 1:15pm, Fadhel Al-Hashim wrote:
>
> > I did not add indices on those columns assuming that being PK is enough?
> is
> > that right?
>
> How did you define the primary keys ?  Was it PRIMARY KEY (x,y,z) ?
>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Delete from A what is not in B

2010-10-02 Thread Fadhel Al-Hashim
I did not add indices on those columns assuming that being PK is enough? is
that right?

On Sat, Oct 2, 2010 at 3:08 PM, Drake Wilson <dr...@begriffli.ch> wrote:

> Quoth Fadhel Al-Hashim <fad...@gmail.com>, on 2010-10-02 14:51:59 +0300:
> > tryingA.x<>B.xANDA.y<>B.y  ANDA.z<>B.z   would just
> > hang.
>
> Huh?  How are you using that expression?
>
> I'd use DELETE FROM a WHERE NOT EXISTS (SELECT * FROM b WHERE a.key =
> b.key)
> with a suitable composite equality in the subselect.
>
> > Is my data too big for SQLIte? is it really hanging or it could be taking
> 3
> > days?
>
> Table A and (particularly) table B both have indices on those columns,
> right?
>
>   ---> Drake Wilson
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Delete from A what is not in B

2010-10-02 Thread Fadhel Al-Hashim
Good day everyone.

I have two tables that contain about 5 million records. I am trying to write
an SQL command to delete rows from table A with PK (x,y,z) where PK (x,y,z)
is not in table B.

tried using "NOT IN" but my PK is composite.

tryingA.x<>B.xANDA.y<>B.y  ANDA.z<>B.z   would just
hang.

Is my data too big for SQLIte? is it really hanging or it could be taking 3
days?


thank you,

fadhel
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users