[sqlite] hello, new to list
I've been playing around with SQLite for a few days now.. It's pretty impressive. I was curious if there were any plans to support right outer joins and full outer joins? I was hoping to utilize SQLite for a couple home projects I have created in Postgres. I don't think I need a huge horse like Postgres for what I'm doing but in a couple queries I use right outer joins. Thanks! ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Ignoring "The"
Could you do something like select title from foo order by replace(title, 'The ', ''); ?? Or add a order_by column On Wed, Jul 23, 2008 at 8:49 AM, Sherief N. Farouk <[EMAIL PROTECTED]> wrote: > Can you define a custom less-than operator for sorting? If this were C++, > I'd do std::sort(Result.begin(), Results.end(), MyCustomOperator()); > > - Sherief > >> -Original Message- >> From: [EMAIL PROTECTED] [mailto:sqlite-users- >> [EMAIL PROTECTED] On Behalf Of Andrew Gatt >> Sent: Wednesday, July 23, 2008 9:41 AM >> To: General Discussion of SQLite Database >> Subject: Re: [sqlite] Ignoring "The" >> >> >> >> I have a table of music artist names which i'd like to output in >> order. >> >> Normally i just use: >> >> >> >> select * from artists order by artist_name; >> >> >> >> What i'd really like to do is order the artists by name but ignore >> any >> >> "the" or "the," preceding it. >> >> >> >> Any ideas? >> >> >> >> Thanks >> >> >> >> Andrew >> >> >> >> >> > Store it like "Beatles, The" them make the transformation latter, if >> > necessary? >> > >> > That's one idea. >> > >> > Best, >> > Daniel >> > >> > >> Thanks for the reply, I may be able to use this approach in future. But >> there are already many entries in the table and so an SQL statement >> that >> does it for me would be good! >> >> Andrew >> ___ >> 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 statement to get min/max values
Could it be that since you're not defining a type for Data it assumes string? Try creating the table with id integer, externalid integer, data number (or numeric) On Thu, Aug 14, 2008 at 7:00 PM, Dennis Volodomanov <[EMAIL PROTECTED]> wrote: > Hello all, > > I've tried a few SQL statements, but can't seem to get it to work > properly, so I'd like to ask your help. > > Suppose I have a table like this: > > CREATE TABLE test_table (ID INTEGER PRIMARY KEY, ExternalID, Data); > > And some contents: > > 1| 2| -7 > 2| 2| 5 > 3| 1| 0 > 4| 2| -20 > 5| 2| -5 > 6| 2| 1 > 7| 1| 10 > > Now, what I'd like to do is get minimum (-20) and maximum (5) from the > table where ExternalID=2. It must be very simple, but I can't seem to > get the correct result. What I tried was: > > SELECT min(Data) FROM (SELECT Data FROM test_table WHERE ExternalID=2); > > But the above doesn't return the expected result. > > Thanks for your help! > > Dennis > > > ___ > 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 statement to get min/max values
I've got 3.6.0 and it works fine here On Thu, Aug 14, 2008 at 9:09 PM, Dennis Volodomanov <[EMAIL PROTECTED]> wrote: >> I'm using 3.3.5, I'll get the latest and see if works there or not in > a >> few minutes. > > Ok, it works in 3.6.1 - sorry for the troubles... I'll just upgrade the > program then. > > Thank you, > > Dennis > > > ___ > 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] 2 Questions from a newbie
Also why are you adding new columns? doesn't sound like you have the db set up properly.. On Tue, Aug 19, 2008 at 11:53 AM, cstrader <[EMAIL PROTECTED]> wrote: > OK, cool idea... let me try that. > > > - Original Message - > From: "Jeff Hamilton" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]>; "General Discussion of SQLite Database" >> Sent: Tuesday, August 19, 2008 12:51 PM > Subject: Re: [sqlite] 2 Questions from a newbie > > >> If all 2,400 tables have the same 9 columns you could try using a >> single table and adding a column for the ticker of the stock and then >> add an index to that column to allow quick lookups based on the >> ticker. >> >> -Jeff >> >> On Tue, Aug 19, 2008 at 9:44 AM, .:UgumugU:. <[EMAIL PROTECTED]> wrote: >>> Hi cstrader, >>> >>> Just send some table structure and the explain what you are trying todo. >>> In my opinion it is not a good way to deal with 2400 tables :) >>> >>> ugumugu >>> >>> cstrader yazm?s,: I'm just starting with SQLite (from vb.net) and could use some advice. I have a set of 2400 (could get substantially higher) tables in a single database (each table contains daily stock prices for a different stock). Each table has 9 columns (all text for now) and some several thousand rows. So far so good. I need to read those tables sequentially and operate on them. It takes about 18 seconds to open each of the tables in sequence. (i.e. loop through 2400 tables with a select command opening each one) First question... does that sound about right in terms of speed? Is there a way to store the data that might be faster? The data are primarily single precision -- I'm using text format, but perhaps that's not best? Second question: When I open each table I need to add some blank columns to it. So I include some "0 as NewCol" lines to create the new columns with initial 0s. However, adding 20 new columns in this manner increases the total time for the loop from 19 seconds to 49 seconds. This seems like a long time. Is there a faster way to get these empty columns in? More questions later I'm sure... Thanks in advance cs ___ 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 > > ___ > 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] help with SQL
I have this SQL in Postgres and it works fine, I'm trying to port it over to SQLite and having issues.. SQLite doesnt like left outer joining to a subquery.. Can you guys think of a way around this? select b.amountowed, b.apr, b.dueday, b.minimumdue, b.payee, p.note, b.payeeid, case when p.amount is null then 0 else sum(p.amount) end as amount, payments, case when p.amount is null then 0 else 1 end as paid, paiddate, b.iscc, b.isactive from bills b left outer join ( select p.payeeid, sum(p.amount) as amount, max(paiddate) as paiddate, count(*) as payments, p.note from payments p where strftime("%m-%Y",paiddate) = '07-2008' group by p.payeeid, p.note ) p on p.payeeid = b.payeeid group by amountowed, b.apr, b.dueday, b.minimumdue, b.payee, p.note, b.payeeid, p.amount, p.paiddate,p.payments, b.iscc, b.isactive The subquery is used to get the null values so I can check to see if a bill is paid.. Ideas? Thanks ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] help with SQL
It's not liking the "as" ... this works more or less.. select b.amountowed, b.apr, b.dueday, b.minimumdue, b.payee, b.payeeid, b.iscc, b.isactive, p2.payeeid, p2.amount, case p2.amount when '' then 0 else sum(amount) end as amount, case p2.payments when null then 0 else 1 end as paid, payments from bills b left outer join ( select payeeid, sum(amount) amount, max(paiddate) paiddate, count(*) payments from payments p where strftime("%m-%Y",paiddate) = '07-2008' group by p.payeeid ) p2 on p2.payeeid = b.payeeid where isactive = 0 group by amountowed, b.apr, b.dueday, b.minimumdue, b.payee, b.payeeid, p2.amount, p2.paiddate,p2.payments, b.iscc, b.isactive What is p2.payments if the count(*) was null? I've tried when null, when '', when ' '... Is there a nvl() function or something like Oracle has? Thanks On Sat, Aug 30, 2008 at 5:45 PM, Greg Morphis <[EMAIL PROTECTED]> wrote: > I have this SQL in Postgres and it works fine, I'm trying to port it > over to SQLite and having issues.. SQLite doesnt like left outer > joining to a subquery.. > Can you guys think of a way around this? > > select b.amountowed, b.apr, b.dueday, b.minimumdue, b.payee, p.note, > b.payeeid, case when p.amount is null then 0 else sum(p.amount) end as > amount, payments, > case when p.amount is null then 0 else 1 end as paid, paiddate, > b.iscc, b.isactive > from bills b left outer join > ( >select p.payeeid, sum(p.amount) as amount, max(paiddate) as paiddate, > count(*) as payments, p.note >from payments p >where strftime("%m-%Y",paiddate) = '07-2008' >group by p.payeeid, p.note > ) p on p.payeeid = b.payeeid > group by amountowed, b.apr, b.dueday, b.minimumdue, b.payee, p.note, > b.payeeid, p.amount, p.paiddate,p.payments, b.iscc, b.isactive > > The subquery is used to get the null values so I can check to see if a > bill is paid.. > > Ideas? > > Thanks > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] statement is not executing
I've got ColdFusion 8 connecting to my SQLite3 database.. When I run an insert using CFCs I get the error : Error Executing Database Query. statement is not executing What's odd is that the row gets inserted into the table... If I hit refresh in the browser I get the error that the Primary Key must be unique.. Anyone ever seen this? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] statement is not executing
I think it has to do with the JDBC driver I'm using.. I updated to v053 of the sqlitejdbc driver and am still getting the error.. On Sun, Aug 31, 2008 at 5:27 PM, Greg Morphis <[EMAIL PROTECTED]> wrote: > I've got ColdFusion 8 connecting to my SQLite3 database.. > > When I run an insert using CFCs I get the error : > Error Executing Database Query. > statement is not executing > > > What's odd is that the row gets inserted into the table... > If I hit refresh in the browser I get the error that the Primary Key > must be unique.. > > Anyone ever seen this? > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] statement is not executing
To further complicate things.. I removed all of the s and the code works.. I readd them and I get the same Error Executing Database Query. statement is not executing The error occurred in C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\testCF\cfc\myApp\appDAO.cfc: line 92 The Stack Trace looks like : java.sql.SQLException: statement is not executing at org.sqlite.Stmt.checkOpen(Stmt.java:41) at org.sqlite.PrepStmt.getUpdateCount(PrepStmt.java:86) at coldfusion.server.j2ee.sql.JRunStatement.getUpdateCount(JRunStatement.java:277) at coldfusion.sql.Executive.getRowSet(Executive.java:513) at coldfusion.sql.Executive.executeQuery(Executive.java:1205) at coldfusion.sql.Executive.executeQuery(Executive.java:1008) at coldfusion.sql.Executive.executeQuery(Executive.java:939) ... On Sun, Aug 31, 2008 at 6:03 PM, Greg Morphis <[EMAIL PROTECTED]> wrote: > I think it has to do with the JDBC driver I'm using.. I updated to > v053 of the sqlitejdbc driver and am still getting the error.. > > > On Sun, Aug 31, 2008 at 5:27 PM, Greg Morphis <[EMAIL PROTECTED]> wrote: >> I've got ColdFusion 8 connecting to my SQLite3 database.. >> >> When I run an insert using CFCs I get the error : >> Error Executing Database Query. >> statement is not executing >> >> >> What's odd is that the row gets inserted into the table... >> If I hit refresh in the browser I get the error that the Primary Key >> must be unique.. >> >> Anyone ever seen this? >> > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] statement is not executing
I understand this is a sqlite list, I had hoped that I wasnt the only one using it or trying to use it with ColdFusion.. I've also asked this on a CF list, just hoping somewhere out there is the answer.. Anyways, as I just posted the problem seems to be around the wrote: > On 9/1/08, Greg Morphis <[EMAIL PROTECTED]> wrote: >> To further complicate things.. I removed all of the s >> and the code works.. I readd them and I get the same >> >> >> Error Executing Database Query. >> statement is not executing >> >> >> The error occurred in >> >> C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\testCF\cfc\myApp\appDAO.cfc: >> line 92 >> >> The Stack Trace looks like : >> >> java.sql.SQLException: statement is not executing >> at org.sqlite.Stmt.checkOpen(Stmt.java:41) >> at org.sqlite.PrepStmt.getUpdateCount(PrepStmt.java:86) >> at >> coldfusion.server.j2ee.sql.JRunStatement.getUpdateCount(JRunStatement.java:277) >> at coldfusion.sql.Executive.getRowSet(Executive.java:513) >> at coldfusion.sql.Executive.executeQuery(Executive.java:1205) >> at coldfusion.sql.Executive.executeQuery(Executive.java:1008) >> at coldfusion.sql.Executive.executeQuery(Executive.java:939) >> ... >> >> >> >> >> >> On Sun, Aug 31, 2008 at 6:03 PM, Greg Morphis <[EMAIL PROTECTED]> wrote: >> > I think it has to do with the JDBC driver I'm using.. I updated to >> > v053 of the sqlitejdbc driver and am still getting the error.. >> > >> > >> > On Sun, Aug 31, 2008 at 5:27 PM, Greg Morphis <[EMAIL PROTECTED]> wrote: >> >> I've got ColdFusion 8 connecting to my SQLite3 database.. >> >> >> >> When I run an insert using CFCs I get the error : >> >> Error Executing Database Query. >> >> statement is not executing >> >> >> >> >> >> What's odd is that the row gets inserted into the table... >> >> If I hit refresh in the browser I get the error that the Primary Key >> >> must be unique.. >> >> >> >> Anyone ever seen this? >> >> >> > > > > Hi Greg, > > (a long time ago I used to use CF circa version 2 and 3). > > As you have yourself identified, the problem seems to be either with > your own queries, examples of which you have not provided in any of > your emails, or in the JDBC driver. Since neither CF nor the JDBC > driver are the focus of this list, you are unlikely to get much > response here... after all, this is a SQLite list, and SQLite seems to > be working fine. > > Perhaps if you were to provide example of your code, the query you are > doing, perhaps someone might be able to point out possible > logic/syntax errors, but other than that, you will likely get more > mileage from either CF list or from the provider of the JDBC driver. > > Fwiw, I have found that the JDBC driver does work fine, but most of my > queries have been rather simple via straight-ahead Java. > > > > -- > Puneet Kishor http://punkish.eidesis.org/ > Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/ > Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/ > ___ > 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] statement is not executing
It's just a simple insert into table (columns) values (values) INSERT INTO BILLS ( PAYEEID, PAYEE, MINIMUMDUE, DUEDAY, ISCC, ISACTIVE, AMOUNTOWED, APR ) VALUES ( , , , , , , , ) and the DB looks like.. CREATE TABLE bills ( payeeid integer primary key, payee TEXT, minimumdue numeric, apr numeric, amountowed real, iscc numeric DEFAULT 1, dueday TEXT, isactive numeric DEFAULT 1 ) On Mon, Sep 1, 2008 at 10:24 AM, P Kishor <[EMAIL PROTECTED]> wrote: > On 9/1/08, Greg Morphis <[EMAIL PROTECTED]> wrote: >> I understand this is a sqlite list, I had hoped that I wasnt the only >> one using it or trying to use it with ColdFusion.. >> I've also asked this on a CF list, just hoping somewhere out there is >> the answer.. > > No, no... don't get me wrong. There is no problem with describing the > tools you are using (CF and JDBC driver, in this case). However, you > have given no other context... no db schema, no example code, the > query you are executing, etc. There is little here for anyone to try > and help, other than if there happens to be another CF/SQLite/JDBC > user. > > Just offer more details, and you have a slightly better chance of > getting a meaningful reply. > >> >> Anyways, as I just posted the problem seems to be around the >> > >> I suppose since this is a local app, I don't need the > tags, just looking for answers... >> >> Thanks >> >> >> >> On Mon, Sep 1, 2008 at 10:03 AM, P Kishor <[EMAIL PROTECTED]> wrote: >> > On 9/1/08, Greg Morphis <[EMAIL PROTECTED]> wrote: >> >> To further complicate things.. I removed all of the s >> >> and the code works.. I readd them and I get the same >> >> >> >> >> >> Error Executing Database Query. >> >> statement is not executing >> >> >> >> >> >> The error occurred in >> >> >> C:\JRun4\servers\cfusion\cfusion-ear\cfusion-war\testCF\cfc\myApp\appDAO.cfc: >> >> line 92 >> >> >> >> The Stack Trace looks like : >> >> >> >> java.sql.SQLException: statement is not executing >> >> at org.sqlite.Stmt.checkOpen(Stmt.java:41) >> >> at org.sqlite.PrepStmt.getUpdateCount(PrepStmt.java:86) >> >> at >> coldfusion.server.j2ee.sql.JRunStatement.getUpdateCount(JRunStatement.java:277) >> >> at coldfusion.sql.Executive.getRowSet(Executive.java:513) >> >> at coldfusion.sql.Executive.executeQuery(Executive.java:1205) >> >> at coldfusion.sql.Executive.executeQuery(Executive.java:1008) >> >> at coldfusion.sql.Executive.executeQuery(Executive.java:939) >> >> ... >> >> >> >> >> >> >> >> >> >> >> >> On Sun, Aug 31, 2008 at 6:03 PM, Greg Morphis <[EMAIL PROTECTED]> wrote: >> >> > I think it has to do with the JDBC driver I'm using.. I updated to >> >> > v053 of the sqlitejdbc driver and am still getting the error.. >> >> > >> >> > >> >> > On Sun, Aug 31, 2008 at 5:27 PM, Greg Morphis <[EMAIL PROTECTED]> >> wrote: >> >> >> I've got ColdFusion 8 connecting to my SQLite3 database.. >> >> >> >> >> >> When I run an insert using CFCs I get the error : >> >> >> Error Executing Database Query. >> >> >> statement is not executing >> >> >> >> >> >> >> >> >> What's odd is that the row gets inserted into the table... >> >> >> If I hit refresh in the browser I get the error that the Primary Key >> >> >> must be unique.. >> >> >> >> >
Re: [sqlite] statement is not executing
I rebuilt the table as CREATE TABLE bills ( payeeid integer primary key, payee TEXT, minimumdue float, apr float, amountowed float, iscc integer DEFAULT 1, dueday TEXT, isactive integer DEFAULT 1 ) On Mon, Sep 1, 2008 at 10:46 AM, Greg Morphis <[EMAIL PROTECTED]> wrote: > It's just a simple insert into table (columns) values (values) > > > > > > > > >INSERT INTO > BILLS > ( > PAYEEID, > PAYEE, > MINIMUMDUE, > DUEDAY, > ISCC, > ISACTIVE, > AMOUNTOWED, > APR > ) >VALUES > ( > value="#arguments.bill.getPayeeID()#" > cfsqltype="cf_sql_numeric" />, > value="#arguments.bill.getPayee()#" > cfsqltype="cf_sql_longvarchar" />, > > value="#arguments.bill.getMinimumDue()#" > cfsqltype="cf_sql_numeric" />, > value="#arguments.bill.getDueDay()#" > cfsqltype="cf_sql_longvarchar" />, > value="#arguments.bill.getIsCC()#" > cfsqltype="cf_sql_numeric" />, > value="#arguments.bill.getIsActive()#" > cfsqltype="cf_sql_numeric" />, > > value="#arguments.bill.getAmountOwed()#" > cfsqltype="cf_sql_numeric" />, > value="#arguments.bill.getAPR()#" > cfsqltype="cf_sql_numeric" /> > ) > > > > > > > and the DB looks like.. > > CREATE TABLE bills > ( > payeeid integer primary key, > payee TEXT, > minimumdue numeric, > apr numeric, > amountowed real, > iscc numeric DEFAULT 1, > dueday TEXT, > isactive numeric DEFAULT 1 > ) > > > > > > > > On Mon, Sep 1, 2008 at 10:24 AM, P Kishor <[EMAIL PROTECTED]> wrote: >> On 9/1/08, Greg Morphis <[EMAIL PROTECTED]> wrote: >>> I understand this is a sqlite list, I had hoped that I wasnt the only >>> one using it or trying to use it with ColdFusion.. >>> I've also asked this on a CF list, just hoping somewhere out there is >>> the answer.. >> >> No, no... don't get me wrong. There is no problem with describing the >> tools you are using (CF and JDBC driver, in this case). However, you >> have given no other context... no db schema, no example code, the >> query you are executing, etc. There is little here for anyone to try >> and help, other than if there happens to be another CF/SQLite/JDBC >> user. >> >> Just offer more details, and you have a slightly better chance of >> getting a meaningful reply. >> >>> >>> Anyways, as I just posted the problem seems to be around the >>> >> >>> I suppose since this is a local app, I don't need the >> tags, just looking for answers... >>> >>> Thanks >>> >>> >>> >>> On Mon, Sep 1, 2008 at 10:03 AM, P Kishor <[EMAIL PROTECTED]> wrote: >>> > On 9/1/08, Greg Morphis <[EMAIL PROTECTED]> wrote: >>> >> To further complicate things.. I removed all of the s >>> >> and the code works.. I readd them and I get the same >>> >> >>> >> >>> >> Error Executing Database Query. >>> >> statement is not executing >>> >> >>> >> >>> >> The er