Re: [sqlite] how to divide a database?

2009-03-13 Thread Ken


on lower half..
attach database 'yourdbname' as full;


insert into table1 select * from full.table1 where col1 < 'your mid point 
value';

on upper half
attach database 'yourdbname' as full;
insert into table1 select * from full.table1 where col1 >= 'your mid point 
value';


You'll need a unique index or primary key on the tables.. In the above col1 is 
your unique column or primary key

HTH



--- On Fri, 3/13/09, baxy77bax <b...@hi.htnet.hr> wrote:

> From: baxy77bax <b...@hi.htnet.hr>
> Subject: Re: [sqlite] how to divide a database?
> To: sqlite-users@sqlite.org
> Date: Friday, March 13, 2009, 3:21 AM
> ok,
>  and how to construct a query that says; select data from
> table until row
> number = 'middle point or so...'.
> 
> or 
> 
> generally how to say; select 30 rows then transfer it into
> new table , then
> select next 30 rows and do the same... and so on until you
> reach the end 
> 
> iteration is not such a problem but the problem is ::: 
> 
> 
> how to say: select 30 rows   ->  this is the actual
> question !
> 
> thnx 
> 
> 
> 
> 
> ken-33 wrote:
> > 
> > 
> > You'll need to know something about your data.
> You'll need the 
> > midpoint of each table so or at least something close.
> > 
> > Then create two db's attach the original. And
> insert the data using a
> > select statement with a where clause.
> > 
> > 
> > 
> > --- On Thu, 3/12/09, baxy77bax
> <b...@hi.htnet.hr> wrote:
> > 
> >> From: baxy77bax <b...@hi.htnet.hr>
> >> Subject: Re: [sqlite] how to divide a database?
> >> To: sqlite-users@sqlite.org
> >> Date: Thursday, March 12, 2009, 4:13 PM
> >> ok, i have one database with two tables and i want
> to create
> >> two databases ,
> >> each with two tables in which contain half of the
> initial
> >> data
> >> 
> >> input:
> >> 
> >> db
> >> table1   table2
> >>  11
> >>  22
> >>  33
> >>  44
> >> 
> >> 
> >> result:
> >> 
> >> db1 db2 
> >> table1 table2table1table2
> >>    11   33
> >>    22   44
> >>  
> >> 
> >> Jim Dodgen wrote:
> >> > 
> >> > I am confused also.
> >> > 
> >> > Are you wanting to put half the rows from
> each table
> >> in each database?
> >> > 
> >> > On Thu, Mar 12, 2009 at 2:01 PM, baxy77bax
> >> <b...@hi.htnet.hr> wrote:
> >> >>
> >> >> hi,
> >> >> let say that i have one db with 2 tables
> in it.
> >> and now i wish to  divide
> >> >> that database in 2 equal (half size of
> the
> >> original) databases. two
> >> >> tables
> >> >> in initial database have one column. how
> would i
> >> do that ?:confused:
> >> >> any suggestions
> >> >>
> >> >> thank you
> >> >> --
> >> >> View this message in context:
> >> >>
> >>
> http://www.nabble.com/how-to-divide-a-database--tp22485238p22485238.html
> >> >> Sent from the SQLite mailing list archive
> at
> >> Nabble.com.
> >> >>
> >> >>
> ___
> >> >> sqlite-users mailing list
> >> >> sqlite-users@sqlite.org
> >> >>
> >>
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >> >>
> >> > 
> >> > 
> >> > 
> >> > -- 
> >> > Jim Dodgen
> >> > j...@dodgen.us
> >> >
> ___
> >> > sqlite-users mailing list
> >> > sqlite-users@sqlite.org
> >> >
> >>
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >> > 
> >> > 
> >> 
> >> -- 
> >> View this message in context:
> >>
> http://www.nabble.com/how-to-divide-a-database--tp22485238p22485445.html
> >> Sent from the SQLite mailing list archive at
> Nabble.com.
> >> 
> >> ___
> >> 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
> > 
> > 
> 
> -- 
> View this message in context:
> http://www.nabble.com/how-to-divide-a-database--tp22485238p22492011.html
> Sent from the SQLite mailing list archive at Nabble.com.
> 
> ___
> 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] how to divide a database?

2009-03-13 Thread baxy77bax

ok,
 and how to construct a query that says; select data from table until row
number = 'middle point or so...'.

or 

generally how to say; select 30 rows then transfer it into new table , then
select next 30 rows and do the same... and so on until you reach the end 

iteration is not such a problem but the problem is ::: 


how to say: select 30 rows   ->  this is the actual question !

thnx 




ken-33 wrote:
> 
> 
> You'll need to know something about your data. You'll need the 
> midpoint of each table so or at least something close.
> 
> Then create two db's attach the original. And insert the data using a
> select statement with a where clause.
> 
> 
> 
> --- On Thu, 3/12/09, baxy77bax <b...@hi.htnet.hr> wrote:
> 
>> From: baxy77bax <b...@hi.htnet.hr>
>> Subject: Re: [sqlite] how to divide a database?
>> To: sqlite-users@sqlite.org
>> Date: Thursday, March 12, 2009, 4:13 PM
>> ok, i have one database with two tables and i want to create
>> two databases ,
>> each with two tables in which contain half of the initial
>> data
>> 
>> input:
>> 
>> db
>> table1   table2
>>  11
>>  22
>>  33
>>  44
>> 
>> 
>> result:
>> 
>> db1 db2 
>> table1 table2table1table2
>>    11   33
>>    22   44
>>  
>> 
>> Jim Dodgen wrote:
>> > 
>> > I am confused also.
>> > 
>> > Are you wanting to put half the rows from each table
>> in each database?
>> > 
>> > On Thu, Mar 12, 2009 at 2:01 PM, baxy77bax
>> <b...@hi.htnet.hr> wrote:
>> >>
>> >> hi,
>> >> let say that i have one db with 2 tables in it.
>> and now i wish to  divide
>> >> that database in 2 equal (half size of the
>> original) databases. two
>> >> tables
>> >> in initial database have one column. how would i
>> do that ?:confused:
>> >> any suggestions
>> >>
>> >> thank you
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/how-to-divide-a-database--tp22485238p22485238.html
>> >> Sent from the SQLite mailing list archive at
>> Nabble.com.
>> >>
>> >> ___
>> >> sqlite-users mailing list
>> >> sqlite-users@sqlite.org
>> >>
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>> >>
>> > 
>> > 
>> > 
>> > -- 
>> > Jim Dodgen
>> > j...@dodgen.us
>> > ___
>> > sqlite-users mailing list
>> > sqlite-users@sqlite.org
>> >
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>> > 
>> > 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/how-to-divide-a-database--tp22485238p22485445.html
>> Sent from the SQLite mailing list archive at Nabble.com.
>> 
>> ___
>> 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
> 
> 

-- 
View this message in context: 
http://www.nabble.com/how-to-divide-a-database--tp22485238p22492011.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] how to divide a database?

2009-03-12 Thread Ken

You'll need to know something about your data. You'll need the 
midpoint of each table so or at least something close.

Then create two db's attach the original. And insert the data using a select 
statement with a where clause.



--- On Thu, 3/12/09, baxy77bax <b...@hi.htnet.hr> wrote:

> From: baxy77bax <b...@hi.htnet.hr>
> Subject: Re: [sqlite] how to divide a database?
> To: sqlite-users@sqlite.org
> Date: Thursday, March 12, 2009, 4:13 PM
> ok, i have one database with two tables and i want to create
> two databases ,
> each with two tables in which contain half of the initial
> data
> 
> input:
> 
> db
> table1   table2
>  11
>  22
>  33
>  44
> 
> 
> result:
> 
> db1 db2 
> table1 table2table1table2
>    11   33
>    22   44
>  
> 
> Jim Dodgen wrote:
> > 
> > I am confused also.
> > 
> > Are you wanting to put half the rows from each table
> in each database?
> > 
> > On Thu, Mar 12, 2009 at 2:01 PM, baxy77bax
> <b...@hi.htnet.hr> wrote:
> >>
> >> hi,
> >> let say that i have one db with 2 tables in it.
> and now i wish to  divide
> >> that database in 2 equal (half size of the
> original) databases. two
> >> tables
> >> in initial database have one column. how would i
> do that ?:confused:
> >> any suggestions
> >>
> >> thank you
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/how-to-divide-a-database--tp22485238p22485238.html
> >> Sent from the SQLite mailing list archive at
> Nabble.com.
> >>
> >> ___
> >> sqlite-users mailing list
> >> sqlite-users@sqlite.org
> >>
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >>
> > 
> > 
> > 
> > -- 
> > Jim Dodgen
> > j...@dodgen.us
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> >
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> > 
> > 
> 
> -- 
> View this message in context:
> http://www.nabble.com/how-to-divide-a-database--tp22485238p22485445.html
> Sent from the SQLite mailing list archive at Nabble.com.
> 
> ___
> 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