Re: [sqlite] FTS4 code from the website

2011-06-29 Thread Dan Kennedy
On 06/30/2011 10:31 AM, Ryan Henrie wrote: > Reference Page: http://www.sqlite.org/fts3.html#appendix_a > > At the bottom of the page, there is a sample c file to calculate the > rank, and a FTS query to use it. I can't get it to work. > > You can see my files here: > > http://coldmist.homeip.net/

[sqlite] FTS4 code from the website

2011-06-29 Thread Ryan Henrie
Reference Page: http://www.sqlite.org/fts3.html#appendix_a At the bottom of the page, there is a sample c file to calculate the rank, and a FTS query to use it. I can't get it to work. You can see my files here: http://coldmist.homeip.net/quotes_sql_test.txt http://coldmist.homeip.net/rank.c.t

Re: [sqlite] Query Alternatives

2011-06-29 Thread Igor Tandetnik
On 6/29/2011 12:53 PM, Pete wrote: > Looking for opinions on the relative efiiciency of Scalar queries versus > non-scalar with JOIN statements. > > For example, the following two queries would produce the same results but > would one of them be significantly faster than the other? > > SELECT colum

[sqlite] Query Alternatives

2011-06-29 Thread Pete
Looking for opinions on the relative efiiciency of Scalar queries versus non-scalar with JOIN statements. For example, the following two queries would produce the same results but would one of them be significantly faster than the other? SELECT column1, tableB.column2 FROM TableA LEFT JOIN TableB

Re: [sqlite] Simple schema design help

2011-06-29 Thread BareFeetWare
On 30/06/2011, at 12:35 AM, Ian Hardingham wrote: > I have an existing table, the matchTable, where each entry holds a lot > of information about a "match". > > I am adding a tournament system, and each match will either be in a > tournament or not in a tournament. > > Should I add a "tourname

Re: [sqlite] Simple schema design help

2011-06-29 Thread Mr. Puneet Kishor
On Jun 29, 2011, at 10:35 AM, Ian Hardingham wrote: > Hey guys. > > I have an existing table, the matchTable, where each entry holds a lot > of information about a "match". > > I am adding a tournament system, and each match will either be in a > tournament or not in a tournament. > > Should

[sqlite] Simple schema design help

2011-06-29 Thread Ian Hardingham
Hey guys. I have an existing table, the matchTable, where each entry holds a lot of information about a "match". I am adding a tournament system, and each match will either be in a tournament or not in a tournament. Should I add a "tournamentID" column to matchTable? Or should I create a new

Re: [sqlite] Auto index with wrong number of entries

2011-06-29 Thread Adam DeVita
Good idea. The result was : ok Of note, we found in our dump and import duplicate 4 entries that violated uniqueness of the primary key. (2 entries of 4 different primary keys, with only 1 other field having a different int.) We identified which one belongs and commented out the others. How did

Re: [sqlite] sqlite3 read file and execute sql too slow

2011-06-29 Thread Simon Slavin
On 29 Jun 2011, at 2:27pm, profove wrote: > There were about two hundred thousand of insert statements, but it > executed too slow. Before the first INSERT statement insert a command 'BEGIN;'. After the last INSERT statement insert a command 'COMMIT;'. Simon. ___

[sqlite] sqlite3 read file and execute sql too slow

2011-06-29 Thread profove
.read FILENAME Execute SQL in FILENAME When I want to restore a database. I execute a command in sqlite3 with ".read file" then execute my sql statements in the named file. There were about two hundred thousand of insert statements, but it executed too slow. I checked the source code and it will

Re: [sqlite] Auto index with wrong number of entries

2011-06-29 Thread Simon Slavin
On 29 Jun 2011, at 2:04pm, Adam DeVita wrote: > On Tue, Jun 28, 2011 at 11:34 AM, Simon Slavin wrote: > >> Use the sqlite3 command-line shell to dump the database to SQL commands, >> then create a new database by reading it back in. >> >> While the data is in the SQL command file, you can take

Re: [sqlite] Auto index with wrong number of entries

2011-06-29 Thread Adam DeVita
Success! On Tue, Jun 28, 2011 at 11:34 AM, Simon Slavin wrote: > > On 28 Jun 2011, at 4:22pm, Adam DeVita wrote: > > > I can see the data that I want to export. How do I fix these indexes? > > Use the sqlite3 command-line shell to dump the database to SQL commands, > then create a new databa

Re: [sqlite] Documentation for when/what exceptions are thrown?

2011-06-29 Thread Down, Jason
Well I checked the source code and there is no xml comments for any of the exceptions. This explains why they don't show up in the chm help file or in Intellisense. I've requested that the documentation be added (or offered to do it for them). We'll see what happens. -Jay- -Original Mess

Re: [sqlite] Compute percentage?

2011-06-29 Thread Gilles Ganault
On Wed, 29 Jun 2011 13:21:21 +0200, Roger Andersson wrote: >:) No CAST needed >SELECT round((COUNT(rowid))/(SELECT COUNT(*)*0.01 FROM people),2) FROM >people WHERE zip="12345"; Thanks everyone. ___ sqlite-users mailing list sqlite-users@sqlite.org htt

Re: [sqlite] Compute percentage?

2011-06-29 Thread Roger Andersson
On 06/29/11 01:01 PM, Cecil Westerhof wrote: > 2011/6/29 Roger Andersson mailto:r...@telia.com>> > > SELECT round(cast(COUNT(rowid)*100 as real)/(SELECT COUNT(*) FROM > people),2) FROM people WHERE zip="12345"; > > > Would it not be better to do the CAST on the second SELECT? Then there

Re: [sqlite] Compute percentage?

2011-06-29 Thread Roger Andersson
On 06/29/11 01:02 PM, Mr. Puneet Kishor wrote: > SELECT (COUNT(rowid)*100)/(SELECT COUNT(*) FROM people) * 1.00 AS percentage > FROM people > WHERE zip="12345"; Seems to always return .0 ? /Roger ___ sqlite-users mailing list sqlite-users@sqlite.org htt

Re: [sqlite] Compute percentage?

2011-06-29 Thread Mr. Puneet Kishor
On Jun 29, 2011, at 6:53 AM, Roger Andersson wrote: > On 06/29/11 12:34 PM, Gilles Ganault wrote: >> Thanks, that worked: >> SELECT COUNT(*) FROM people; >> 400599 >> >> SELECT COUNT(*) FROM people WHERE zip="12345"; >> 12521 >> >> SELECT (COUNT(rowid)*100)/(SELECT COUNT(*) FROM people) FROM p

Re: [sqlite] Compute percentage?

2011-06-29 Thread Cecil Westerhof
2011/6/29 Roger Andersson > SELECT round(cast(COUNT(rowid)*100 as real)/(SELECT COUNT(*) FROM > people),2) FROM people WHERE zip="12345"; > Would it not be better to do the CAST on the second SELECT? Then there is only one CAST needed. In this case it does not matter much, but in the general cas

Re: [sqlite] Compute percentage?

2011-06-29 Thread Roger Andersson
On 06/29/11 12:34 PM, Gilles Ganault wrote: > Thanks, that worked: > SELECT COUNT(*) FROM people; > 400599 > > SELECT COUNT(*) FROM people WHERE zip="12345"; > 12521 > > SELECT (COUNT(rowid)*100)/(SELECT COUNT(*) FROM people) FROM people > WHERE zip="12345"; > 3 > > Is it possible to display the

Re: [sqlite] Compute percentage?

2011-06-29 Thread Simon Davies
On 29 June 2011 11:34, Gilles Ganault wrote: > On Wed, 29 Jun 2011 11:33:15 +0200, Roger Andersson > wrote: >>SELECT (COUNT(rowid)*100)/(select count(*) from people) FROM people WHERE >>zip="12345"; > > Thanks, that worked: > > SELECT COUNT(*) FROM people; > 400599 > > SELECT COUNT(*) FROM peopl

Re: [sqlite] Compute percentage?

2011-06-29 Thread Gilles Ganault
On Wed, 29 Jun 2011 11:33:15 +0200, Roger Andersson wrote: >SELECT (COUNT(rowid)*100)/(select count(*) from people) FROM people WHERE >zip="12345"; Thanks, that worked: SELECT COUNT(*) FROM people; 400599 SELECT COUNT(*) FROM people WHERE zip="12345"; 12521 SELECT (COUNT(rowid)*100)/(SELECT C

Re: [sqlite] Compute percentage?

2011-06-29 Thread Oliver Peters
Oliver Peters writes: I definitely need glasses for my glasses AS cnt_all_people belongs after COUNT(zip) so this is correct SELECT a.zip, a.cnt_people_in_town, b.cnt_all_people ( SELECT zip, COUNT(zip) AS cnt_people_in_town FROM people GROUP BY zip ) a CROSS JOIN ( SELECT COUNT(zip) AS cnt_

Re: [sqlite] Compute percentage?

2011-06-29 Thread Oliver Peters
Gilles Ganault writes: SELECT a.zip, a.cnt_people_in_town, b.cnt_all_people ( SELECT zip, COUNT(zip) AS cnt_people_in_town FROM people GROUP BY zip ) a CROSS JOIN ( SELECT COUNT(zip) FROM people AS cnt_all_people ) b ; percent for you greetings oliver ___

Re: [sqlite] Compute percentage?

2011-06-29 Thread Roger Andersson
On 06/29/11 11:22 AM, Gilles Ganault wrote: > Hello > > Using a table that lists people and the zipcode where they live, I > need to compute the percentage of those living in, say, NYC. > > I googled for this, but I'm not sure how to do this in SQLite. > > I wonder if it's done through a su

[sqlite] Compute percentage?

2011-06-29 Thread Gilles Ganault
Hello Using a table that lists people and the zipcode where they live, I need to compute the percentage of those living in, say, NYC. I googled for this, but I'm not sure how to do this in SQLite. I wonder if it's done through a sub-query or maybe some temporary variable? This computes

[sqlite] Test message, please ignore...

2011-06-29 Thread sqlite
Test. -- Joe Mistachkin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users