Hi Simon, Thanks for your answer, I suppose by ", ..." in the create table command you mean that I should explicitly specifying each column, which is exactly what I didn't want to do in the first place.
By your response I guess that there is no other way of doing it then.... Well I will test and decide which method from yours or the copy method from the sqlite website suit me the best. Thanks for your help.... In the mean time if someone else has an other idea, it will be welcome.... Fabou On 19 May 2010 10:33, Simon Davies <simon.james.dav...@googlemail.com>wrote: > On 19 May 2010 08:31, Raoul <pazou...@gmail.com> wrote: > > Hi all, > > > > I have read that it’s not possible to alter an existing table to add a > > primary key, this is causing me some troubles. I have a table > “My_main_tbl” > > from where I want to take a subset of rows in order to create a new > table > > with the exact same columns. > > > > CREATE TABLE My_second_tbl AS SELECT * FROM My_main_tbl WHERE topic = > > ‘aviation’ > > > > My problem is that is on my original table the column QID is a primary > key > > but on my new created table the column QID is not a primary key anymore, > in > > fact I have no primary key at all. > > > > Is there any way of doing this without explicitly specifying each > column, > > and without going into doing the copy table as explained in > > http://www.sqlite.org/faq.html#q11 ? > > > > As far as I can read over the net SELECT INTO is not supported in > sqlite, > > right? > > CREATE TABLE My_second_tbl( qid integer primary key, ... ); > INSERT INTO My_second_tb SELECT * FROM My_main_tbl WHERE topic = > ‘aviation’; > > > > > Thanks for your help, > > > > Fabou > > Regards, > 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