Re: [sqlite] SQL script help.

2010-08-27 Thread Black, Michael (IS)
What language are you writing in?  Why do you need to know the # of rows?  What 
are you doing with that information?
 
The select itself does stop (obviously).  
 
>From  a Windows command prompt you can just do this
 
echo SELECT * FROM myTable WHERE _rowid_ >= 100 AND _rowid_ <= 102 | sqlite3 
mytable.db

And then you can redirect the output wherever hyou want.
 
Just add quotes around the select statement for Unix.
 
 
Michael D. Black
Senior Scientist
Advanced Analytics Directorate
Northrop Grumman Information Systems
 



From: sqlite-users-boun...@sqlite.org on behalf of Kirk Clemons
Sent: Thu 8/26/2010 1:01 PM
To: 'General Discussion of SQLite Database'
Subject: EXTERNAL:Re: [sqlite] SQL script help.



I would like to be able to create an output log of each row. But I need to know 
how many rows there are in the database unless there is a way to tell sqlite to 
stop at the end?

-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Israel Lins Albuquerque
Sent: Thursday, August 26, 2010 10:58 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] SQL script help.

Or you can do:
SELECT * FROM myTable WHERE _rowid_ IN (100, 101, 102)

depending what you want


- "Simon Slavin"  escreveu:
>
> On 26 Aug 2010, at 3:39pm, Kirk Clemons wrote:
>
> > SELECT * FROM myTable WHERE _rowid_ = 100; SELECT * FROM myTable WHERE 
> > _rowid_ = 101; SELECT * FROM myTable WHERE _rowid_ = 102;
>
> SELECT * FROM myTable WHERE _rowid_ BETWEEN 100 AND 102
>
> or
>
> SELECT * FROM myTable WHERE _rowid_ >= 100 AND _rowid_ <= 102
>
> will give identical results. Technically speaking you might want to add 
> 'ORDER BY _rowid_' to the end of those if the order matters.
>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>

--

Atenciosamente/Regards,

Israel Lins Albuquerque
Desenvolvimento/Development
Polibrás Brasil Software Ltda.


___
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-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQL script help.

2010-08-27 Thread Denis Gomes
Kirk,

 You can use the aggregate function count.  So if  you have a table
called foo, do this,

SELECT COUNT(*) FROM foo;

That'll give you the number of rows in the table.

Denis

On Fri, Aug 27, 2010 at 6:30 AM, Paul Corke wrote:

> On 26 August 2010 19:02, Kirk Clemons wrote:
>
> > I would like to be able to create an output log of each row. But I
> > need to know how many rows there are in the database unless there is
> > a way to tell sqlite to stop at the end?
>
> Do you just want:
>
> SELECT * FROM myTable
>
> which will return every row and stop at the end.
>
> Paul.
> ___
>  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] SQL script help.

2010-08-27 Thread Paul Corke
On 26 August 2010 19:02, Kirk Clemons wrote:

> I would like to be able to create an output log of each row. But I
> need to know how many rows there are in the database unless there is
> a way to tell sqlite to stop at the end?  

Do you just want:

SELECT * FROM myTable

which will return every row and stop at the end.

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


Re: [sqlite] SQL script help.

2010-08-27 Thread Kirk Clemons
I would like to be able to create an output log of each row. But I need to know 
how many rows there are in the database unless there is a way to tell sqlite to 
stop at the end?

-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Israel Lins Albuquerque
Sent: Thursday, August 26, 2010 10:58 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] SQL script help.

Or you can do: 
SELECT * FROM myTable WHERE _rowid_ IN (100, 101, 102) 

depending what you want 


- "Simon Slavin"  escreveu: 
> 
> On 26 Aug 2010, at 3:39pm, Kirk Clemons wrote: 
> 
> > SELECT * FROM myTable WHERE _rowid_ = 100; SELECT * FROM myTable WHERE 
> > _rowid_ = 101; SELECT * FROM myTable WHERE _rowid_ = 102; 
> 
> SELECT * FROM myTable WHERE _rowid_ BETWEEN 100 AND 102 
> 
> or 
> 
> SELECT * FROM myTable WHERE _rowid_ >= 100 AND _rowid_ <= 102 
> 
> will give identical results. Technically speaking you might want to add 
> 'ORDER BY _rowid_' to the end of those if the order matters. 
> 
> Simon. 
> ___ 
> sqlite-users mailing list 
> sqlite-users@sqlite.org 
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users 
> 

-- 

Atenciosamente/Regards, 

Israel Lins Albuquerque 
Desenvolvimento/Development 
Polibrás Brasil Software Ltda. 


___
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] SQL script help.

2010-08-27 Thread Kirk Clemons
Thank you,
So how do I get the total count of rows?
-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Simon Slavin
Sent: Thursday, August 26, 2010 8:59 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] SQL script help.


On 26 Aug 2010, at 3:39pm, Kirk Clemons wrote:

> SELECT * FROM myTable WHERE _rowid_ = 100; SELECT * FROM myTable WHERE 
> _rowid_ = 101; SELECT * FROM myTable WHERE _rowid_ = 102;

SELECT * FROM myTable WHERE _rowid_ BETWEEN 100 AND 102

or

SELECT * FROM myTable WHERE _rowid_ >= 100 AND _rowid_ <= 102

will give identical results.  Technically speaking you might want to add 'ORDER 
BY _rowid_' to the end of those if the order matters.

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] SQL script help.

2010-08-26 Thread Israel Lins Albuquerque
Or you can do: 
SELECT * FROM myTable WHERE _rowid_ IN (100, 101, 102) 

depending what you want 


- "Simon Slavin"  escreveu: 
> 
> On 26 Aug 2010, at 3:39pm, Kirk Clemons wrote: 
> 
> > SELECT * FROM myTable WHERE _rowid_ = 100; SELECT * FROM myTable WHERE 
> > _rowid_ = 101; SELECT * FROM myTable WHERE _rowid_ = 102; 
> 
> SELECT * FROM myTable WHERE _rowid_ BETWEEN 100 AND 102 
> 
> or 
> 
> SELECT * FROM myTable WHERE _rowid_ >= 100 AND _rowid_ <= 102 
> 
> will give identical results. Technically speaking you might want to add 
> 'ORDER BY _rowid_' to the end of those if the order matters. 
> 
> Simon. 
> ___ 
> sqlite-users mailing list 
> sqlite-users@sqlite.org 
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users 
> 

-- 

Atenciosamente/Regards, 

Israel Lins Albuquerque 
Desenvolvimento/Development 
Polibrás Brasil Software Ltda. 


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


Re: [sqlite] SQL script help.

2010-08-26 Thread Simon Slavin

On 26 Aug 2010, at 3:39pm, Kirk Clemons wrote:

> SELECT * FROM myTable WHERE _rowid_ = 100; SELECT * FROM myTable WHERE 
> _rowid_ = 101; SELECT * FROM myTable WHERE _rowid_ = 102;

SELECT * FROM myTable WHERE _rowid_ BETWEEN 100 AND 102

or

SELECT * FROM myTable WHERE _rowid_ >= 100 AND _rowid_ <= 102

will give identical results.  Technically speaking you might want to add 'ORDER 
BY _rowid_' to the end of those if the order matters.

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


[sqlite] SQL script help.

2010-08-26 Thread Kirk Clemons
I have heard about SQL scripts that can automate some processes. Is it possible 
to write a script that performs the following on an entire database?

SELECT * FROM myTable WHERE _rowid_ = 100; SELECT * FROM myTable WHERE _rowid_ 
= 101; SELECT * FROM myTable WHERE _rowid_ = 102;

Regards,
Kirk Clemons
Technical Support Analyst
Chief Architect(r)
6500 N. Mineral Dr.
Coeur d'Alene, Idaho 83815
Phone: (800)482-4433
   (208)664-4204

Professional Software
www.chiefarchitect.com

Consumer Software
www.HomeDesignerSoftware.com

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