Re: [sqlite] Possible to get table size (in bytes)?

2015-02-04 Thread Simon Davies
On 4 February 2015 at 18:26, Rael Bauer supp...@bauerapps.com wrote: Hi, Is it possible to get the information of how many bytes a table is taking up in the database? For Windows, see http://www.sqlite.org/download.html#a10 There are other links for other operating systems Thanks Rael

Re: [sqlite] Update Statements using Sub query

2015-01-20 Thread Simon Davies
On 20 January 2015 at 13:09, MikeSnow michael.sab...@gmail.com wrote: I was wondering if anyone could help I am trying to use Excel to create update statements based on certain criteria. For example...this works UPDATE CDR_Adjusted SET DateTime=DATE|| ||TIME; (This is what I

Re: [sqlite] Is this date supposed to be less than or more than the other?

2015-01-02 Thread Simon Davies
On 3 January 2015 at 00:12, J Decker d3c...@gmail.com wrote: Okay... https://www.sqlite.org/lang_datefunc.html https://www.sqlite.org/datatype3.html /* lists DateTime as a distinct type */ Could you point out where exactly I understand it's kept as a string... and there's no internal

Re: [sqlite] Using binding in sqlite insert statements

2014-12-09 Thread Simon Davies
On 9 December 2014 at 10:56, Prakash Premkumar prakash.p...@gmail.com wrote: Hi, I'm trying to use the sqlite_bind function calls to pass values to the insert queries in sql. Here's the code I'm trying to execute: http://pastebin.com/kMvAHsrk I get an error after the sqlite3_step()

Re: [sqlite] Discrepancy with indexing and WHERE clause with AND/OR

2014-11-10 Thread Simon Davies
On 10 November 2014 16:03, Don V Nielsen donvniel...@gmail.com wrote: Isn't this the result of the results cache? The two queries are identical. The query plan changes... . . . sqlite explain query plan select count(*) from v wherez = 0 and ... ( y

Re: [sqlite] sqlite3.8.7 crashes when creating an index with WAL mode disabled

2014-11-04 Thread Simon Davies
On 4 November 2014 04:17, RP McMurphy rpm0...@yahoo.com wrote: Consider the following build cmd line: gcc -o sqlite3.exe -DSQLITE_OMIT_WAL sqlite3.c shell.c The build succeeds when using MinGW on Windows. Now start the built exe with a memory database: sqlite3 :memory:

Re: [sqlite] Inserting a row with all defaults set in table

2014-10-25 Thread Simon Davies
On 25 October 2014 14:49, Stephen Chrzanowski pontia...@gmail.com wrote: I've got a table that has defaults set for all fields CREATE TABLE [tEvents] ( [EventID] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, [Airline] CHAR DEFAULT '', [TicketID] INTEGER DEFAULT 0, [Resolved] BOOL

Re: [sqlite] how to join 3 tables from a sqlite database?

2014-03-25 Thread Simon Davies
On 25 March 2014 14:09, Christian Dallinger dallinger_christ...@hotmail.com wrote: Hello, I want to join these 3 tables from my database: http://pastebin.com/f8FP0G0C something like select Macadress, timestamp, result, user, '', '', '', '' from checklog union select MacAdress, timestamp, '',

Re: [sqlite] How to write a query

2014-03-05 Thread Simon Davies
On 5 March 2014 10:04, Igor Korot ikoro...@gmail.com wrote: Hi, ALL, Let's say I have a table with following data: field1field2field3 field4 12 3 4 5 6 7 8 How do I write a query which will produce the output as: 1 2 5 6

Re: [sqlite] How to write a query

2014-03-05 Thread Simon Davies
On 5 March 2014 10:24, Igor Korot ikoro...@gmail.com wrote: Hi, Simon, . . . Possibly: select v1, v2 from ( select 1 as ordr, f1 as v1, f2 as v2 from t union all select 2, f3, f4 from t ) order by ordr, v1; With UNION I will have 2 DB hits, correct? Meaning I execute the part on the left

Re: [sqlite] Select with dates

2013-09-12 Thread Simon Davies
On 12 September 2013 06:34, jwzumwalt jwzumw...@gmail.com wrote: I have not used the date function in select statements before. I have valid entries for the current month, what am I doing wrong? SELECT * FROM entry WHERE bankdate date('now','end of month','-1 month')

Re: [sqlite] How to use aux_data effectively?

2013-09-06 Thread Simon Davies
On 6 September 2013 16:38, Pepijn Van Eeckhoudt pep...@vaneeckhoudt.net wrote: Hi, In the extension I'm developing (https://bitbucket.org/luciad/libgpkg) I'm currently adding support for queries like: select Distance( GeomFromText('Point(13.457 3)'), geometry ) from table;

Re: [sqlite] v3.8 .import misbehaves

2013-08-28 Thread Simon Davies
On 28 August 2013 13:51, to...@acm.org wrote: I did. I just download the precompiled binaries for Windows, and this is what I see (for that sample data file): C:\tempsqlite3.exe SQLite version 3.8.0 2013-08-26 04:50:08 Enter .help for instructions Enter SQL statements terminated with a ;

Re: [sqlite] v3.8 .import misbehaves

2013-08-28 Thread Simon Davies
On 28 August 2013 14:16, to...@acm.org wrote: OK, now copy the data line several times, and you'll see there are errors for several lines, unrelated to the final CRLF (which I removed this next sample). -- data -- Year,Debt,GDP1,GDP2,RGDP,dRGDP,Infl,debtgdp

Re: [sqlite] Number of Colum!!!

2013-08-13 Thread Simon Davies
On 13 August 2013 15:11, techi eth techi...@gmail.com wrote: Is their any limit on number of Colum in SQLite3 table? Cheers - Techi http://www.sqlite.org/limits.html ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] Query on Update or Selective Insert

2013-08-07 Thread Simon Davies
On 7 August 2013 15:25, Simon Slavin slav...@bigfraud.org wrote: On 7 Aug 2013, at 9:50am, techi eth techi...@gmail.com wrote: I am trying to update 100 variables at a time due to some of the reason 99 th or any mid index variable cause update to fail. In that case this query has to

Re: [sqlite] Query optimization: Checking for existence before performing action

2013-07-29 Thread Simon Davies
On 29 July 2013 12:57, Navaneeth.K.N navaneet...@gmail.com wrote: Hello, I am trying to optimize the SQL calls that my application makes. I have a scenario where words are inserted into a table. Now each word will have a column called confidence. There is a unique primary key on word. When

Re: [sqlite] Access Permission on Table

2013-07-22 Thread Simon Davies
On 22 July 2013 10:02, techi eth techi...@gmail.com wrote: Is their any statement I can build using SQLite3, which will provide me access permission over table. Let us say I have 3 tables (table 1, table 2, table 3). Here I am looking Read permission for one-many but Write can be done by

Re: [sqlite] How to select from a temp table with same name as a main table.

2013-06-18 Thread Simon Davies
On 17 June 2013 23:19, dochsm docshotma...@hotmail.com wrote: I have a table in the main database called 'students' and a two page block of sql that processes it, referring to it as simply 'students'. Experimenting with a different approach, I created a temp table, also called 'students' that

Re: [sqlite] getting transactions working with prepare, step finallise

2013-06-12 Thread Simon Davies
On 12 June 2013 16:50, e-mail mgbg25171 mgbg25...@blueyonder.co.uk wrote: Tbank you in anticipation for any forthcoming advice I include my program below in Powerbasic (not disimilar to C) and wonder what I need to do in order to wrap multiple statements (which use prepare,step finalise) as

Re: [sqlite] Foreign Key constraint problem while dropping tables inside transaction

2013-05-13 Thread Simon Davies
On 13 May 2013 16:52, Simon Slavin slav...@bigfraud.org wrote: On 13 May 2013, at 3:54pm, Григорий Григоренко grigore...@mail.ru wrote: sample database is: PRAGMA FOREIGN_KEYS=1; CREATE TABLE cat(id INTEGER PRIMARY KEY, name); INSERT INTO cat VALUES (1, 'Alice'); CREATE TABLE owner(pet

Re: [sqlite] Is there a command to lock a database for a short while (0.25 sec, say)

2013-04-17 Thread Simon Davies
On 17 April 2013 14:39, J Trahair j.trah...@foreversoftware.co.uk wrote: Hi everyone Can my application lock the database for its own exclusive use at the beginning of a series of INSERTs UPDATEs and SELECTs, then unlock it again afterwards? I've read about the five locking states

Re: [sqlite] FreeBSD and SQLITE_ENABLE_LOCKING_STYLE

2013-04-11 Thread Simon Davies
On 11 April 2013 09:03, Baptiste Daroussin baptiste.darous...@gmail.com wrote: Ok so I was not going in the right direction :) So how it is possible to corrupt a database on nfsv4? Does that ring a bell to someone? In case you have not already seen it:

Re: [sqlite] IMPORT fails INTEGER column but lets same data sail through as INT

2013-03-20 Thread Simon Davies
On 19 March 2013 15:08, rol...@logikalsolutions.com rol...@logikalsolutions.com wrote: version 3.7.9 2011-11-01 00:52:41 KUbuntu 12.04 LTS 32-bit ex1.sql CREATE TABLE table_ex1( Groupid INTEGER PRIMARY KEY, GroupName TEXT ); .separator '|' .import ex1.csv table_ex1 .quit ex1.csv

Re: [sqlite] insert / replace into joined tables.

2013-03-01 Thread Simon Davies
On 1 March 2013 13:29, chas cartmel c...@cartmel.me.uk wrote: Hi guys/gals. First post to this group. I have a problem which can be solved in Access/ SQL Server but not seemingly in SQLite. I am trying to update a value in a table from another identical table where that value has been

Re: [sqlite] got selected items ok but can't update using them

2013-02-20 Thread Simon Davies
On 20 February 2013 11:36, e-mail mgbg25171 mgbg25...@blueyonder.co.uk wrote: After a bit of a struggle I've got the fields I want but I'm failing to use them in an update operation. This SELECT i,o,n FROM ( SELECT alias_id i, (SELECT orig_itm FROM stmnts where ID = alias_id) o, (SELECT

Re: [sqlite] about delete problem

2013-01-16 Thread Simon Davies
On 16 January 2013 08:16, YAN HONG YE yanhong...@mpsa.com wrote: create table mytable( ID integer primary key autoincrement, name nvarchar(32) ); insert into mytable(name) values(aa1); insert into mytable(name) values(aa2); insert into mytable(name) values(aa3); insert into mytable(name)

Re: [sqlite] special aggregate feature vs query optimization

2013-01-10 Thread Simon Davies
On 10 January 2013 17:04, Eduardo Morras emorr...@yahoo.es wrote: On Thu, 10 Jan 2013 14:53:52 +0100 E.Pasma pasm...@concepts.nl wrote: Hello, A query of the form: SELECT max(x), y FROM table returns the value of y on the same row that contains the maximum x value. True I just want to

Re: [sqlite] Result of multi-command _exec() that errors ?

2012-12-04 Thread Simon Davies
On 4 December 2012 11:02, Simon Slavin slav...@bigfraud.org wrote: (Yes, I know I should be preparing and binding for security reasons, but that doesn't work here.) What is the result when using _exec() on multiple statements when one of the statements errors ? I read this page:

Re: [sqlite] What is the easiest way of changing the field type?

2012-12-03 Thread Simon Davies
On 3 December 2012 19:29, Igor Korot ikoro...@gmail.com wrote: Simon, On Mon, Dec 3, 2012 at 11:03 AM, Simon Slavin slav...@bigfraud.org wrote: On 3 Dec 2012, at 6:53pm, Igor Korot ikoro...@gmail.com wrote: Here is the session: sqlite CREATE TABLE test(id1 integer, id2 double); sqlite

Re: [sqlite] What is wrong with this update SQL

2012-11-22 Thread Simon Davies
On 22 November 2012 11:20, Staffan Tylen staffan.ty...@gmail.com wrote: I run this (sql.txt): create table table1 (age_band); insert into table1 values(31); UPDATE table1 SET age_band = (case when age_band = 10 then ' 0 - 10' when age_band BETWEEN 11 AND 20 then ' 11 - 20' when age_band

Re: [sqlite] finding duplicate records i.e. records with same values across 4 colums...

2012-11-08 Thread Simon Davies
On 8 November 2012 11:23, e-mail mgbg25171 mgbg25...@blueyonder.co.uk wrote: I'm using SQLIte. All columns can have duplicate values but it would be helpful to report on those rows which are identical across all columns. More specifically I'm looking for matching itm values where the first 3

Re: [sqlite] couldn't use is null function

2012-11-08 Thread Simon Davies
On 9 November 2012 01:49, YAN HONG YE yanhong...@mpsa.com wrote: sqlite SELECT fmn,IMPLANTATIONgrading FROM T93C_ADL WHERE IMPLANTATIONgrading i s not null and fmn like '85495%'; 854954|R 854952|

Re: [sqlite] sqlite-users Digest, Vol 59, Issue 7

2012-11-08 Thread Simon Davies
On 9 November 2012 01:40, YAN HONG YE yanhong...@mpsa.com wrote: select date( supplierDate, '+2 days' ) ; use this cmd couldn't solve the problem; will have nothing on this column: sqlite select fmn,'84 day'+supplierDate from t93c_adl where fmn like '85493%'; 854939|95 854938|95

Re: [sqlite] how to use julianday function

2012-11-08 Thread Simon Davies
On 9 November 2012 02:42, YAN HONG YE yanhong...@mpsa.com wrote: sqlite select fmn,DATE('NOW'),supplierDate,julianday('now'),julianday(supplierDate),julianday('supplierDate') from t93c_adl where supplierDatejulianday('now') limit 5 ; 854954|2012-11-09|12/01/2012|2456240.61186149||

Re: [sqlite] couldn't use is null function

2012-11-07 Thread Simon Davies
On 7 November 2012 08:27, YAN HONG YE yanhong...@mpsa.com wrote: SELECT * FROM ADL WHERE Project_grading is null; can't select anything. sqlite create table ADL( id integer primary key, data text, Project_grading integer ); sqlite insert into ADL( data, Project_grading ) values( '1', 1 );

Re: [sqlite] FW: about date question

2012-11-07 Thread Simon Davies
On 7 November 2012 09:42, YAN HONG YE yanhong...@mpsa.com wrote: the table had a column: SupplierDate Date I wanna add 84 days : SELECT SupplierDate+84 as date1 FROM ADL; BUT result have noting when use: select date(supplierdate+'2 day') from t93c_adl limit 3; the result is: -4713-12-08

Re: [sqlite] Bug: Inconsistency wrt. indirectly defined columns

2012-11-07 Thread Simon Davies
On 7 November 2012 16:41, stahl...@dbs.uni-hannover.de wrote: Hi! I have encountered inconsistent behavior regarding indirectly defined columns. In the following example: CREATE TABLE main ( id INTEGER PRIMARY KEY ); CREATE TABLE tab1 ( id INTEGER REFERENCES main, str VARCHAR(10) );

Re: [sqlite] Bug: Inconsistency wrt. indirectly defined columns

2012-11-07 Thread Simon Davies
On 7 November 2012 20:36, stahl...@dbs.uni-hannover.de wrote: Quoting Simon Davies simon.james.dav...@gmail.com: . . . I think this is the documented behaviour: http://www.sqlite.org/datatype3.html tab1.id has integer affinity, and '42' is coerced to integer tab2.id has none affinity

Re: [sqlite] SUGGESTION: now as alias for strftime('%s','now')

2012-11-02 Thread Simon Davies
On 2 November 2012 13:08, Григорий Григоренко grigore...@mail.ru wrote: Thu, 1 Nov 2012 19:57:42 + от Simon Slavin slav...@bigfraud.org: Please read http://www.sqlite.org/lang_datefunc.html Surely, I did) Don't get me wrong - my point is not that Sqlite is lacking functions that

Re: [sqlite] primary key with bulk insert (UNION SELECT)

2012-10-12 Thread Simon Davies
On 11 October 2012 15:07, Alan Frankel alan.fran...@mathworks.com wrote: I have a table that uses an autogenerated id as primary key. I want to do bulk inserts using UNION SELECT, but it doesn't seem to be happy unless I specify an id for each row: sqlite create table CelestialObject (id

Re: [sqlite] Size

2012-10-04 Thread Simon Davies
On 4 October 2012 14:06, Alami Omar omarr...@gmail.com wrote: Hello, does SQLite format files have any size(fie size of the sqlite file) info on the header ? Thank you. http://www.sqlite.org/fileformat.html#filesize Regards, Simon ___ sqlite-users

Re: [sqlite] export html error

2012-09-21 Thread Simon Davies
On 21 September 2012 10:35, Kevin Benson kevin.m.ben...@gmail.com wrote: On Fri, Sep 21, 2012 at 4:30 AM, YAN HONG YE yanhong...@mpsa.com wrote: C:\t9sqlite3 -html -header t9_engine.db select id,partnumber,'lt;img src=quo t'||pic||quot;'height=120pxgt;',pcs from engine where id7 n.html

Re: [sqlite] Foreign Key

2012-09-08 Thread Simon Davies
On 7 September 2012 21:28, Dennis Klein dennis.kl...@education-siemens.com wrote: Hallo, I am Using the latest Version of the precompiled shell Application from the Download section, and the C/C++ Sources in Version 3.7.11 Now i created my tables, using Primary Key and Foreign Key

Re: [sqlite] query function release problem

2012-08-02 Thread Simon Davies
On 2 August 2012 08:28, YAN HONG YE yanhong...@mpsa.com wrote: . . . when I use command jii select ccc it shows a problem: jii.exe has encountered a problem and needs to close. We are sorry for the inconvenience. I couldn't resolve it. void query_table(sqlite3 *l_db) { char

Re: [sqlite] C++ - Finalizing my SQLite interface

2012-07-27 Thread Simon Davies
On 27 July 2012 15:22, Arbol One arbol...@gmail.com wrote: Before calling the destructor, I would like to make sure that all the sqlite3_stmt have been 'finalized', is there a function in SQLite that that can help me do this, or should I just use 'NULL'? The documentation is there to help

Re: [sqlite] cann't work

2012-07-11 Thread Simon Davies
On 11 July 2012 10:00, YAN HONG YE yanhong...@mpsa.com wrote: two same structure tables, when use this sql: insert into table2 values(select * from table1 where filename like %55); but show error: sqlite error 1 - near select: syntax error insert into table2 select * from table1 where

Re: [sqlite] how many rows deleted

2012-07-11 Thread Simon Davies
On 12 July 2012 00:21, deltagam...@gmx.net deltagam...@gmx.net wrote: Can I retrieve how many rows are affected from a delete statement like std::string delete_stmt(DELETE FROM mylog WHERE strftime('%Y-%m-%d',thedate) BETWEEN ? AND ? ); http://www.sqlite.org/c3ref/changes.html Regards,

Re: [sqlite] How to use variables in statements ?

2012-06-13 Thread Simon Davies
On 13 June 2012 10:40, deltagam...@gmx.net deltagam...@gmx.net wrote: Im using c++ and like to write from within c++ into sqlite3 db. I saw some tutorials on the sqlite pages, but the statements have always been defined in advance and they have been constant. How to add now new data to sqlite

Re: [sqlite] Query by License -Consulta por Licencia

2012-05-16 Thread Simon Davies
2012/5/16 Guillermo Soland ggsol...@gmail.com: Mr. Representative of SQLite: Hello, my name is Guillermo G. Soland, I live in the city of Villa Constitución, Santa Fe, Argentina, I graduated as a Computer Systems Analyst, but now I do not practice my profession for profit because my job is

Re: [sqlite] ROLLBACK TO savepoint cancels earlier RELEASEs

2012-05-09 Thread Simon Davies
On 9 May 2012 10:33, ext-esko.huja...@elektrobit.com wrote: Hi All, 1: SAVEPOINT 1 2: insert A 3: RELEASE SAVEPOINT 1 4: SAVEPOINT 2 5: insert B 6: ROLLBACK TO SAVEPOINT 2 ROLLBACK in line 6 cancels also line 2 in addition to line 5. I want to cancel just line 5. What am I doing

Re: [sqlite] Having in prepared statement with parameters

2012-05-09 Thread Simon Davies
On 9 May 2012 14:17, Pavel Ivanov paiva...@gmail.com wrote: As the last three statements are exactly the same (in meaning). Can someone explain what's happening? I think you've got trapped by double value storage imprecision. Comparing double values for exact equality is pretty dangerous -

Re: [sqlite] SQlite exclusive table lock

2012-05-03 Thread Simon Davies
On 3 May 2012 20:29, Harnek Manj hm...@gemcomsoftware.com wrote: Hi Simon, Yes I have multiple Threads which are accessing the database. Currently if I am doing a write operation the whole database file is locked, I want the locking applied only to the table in operation. So currently

Re: [sqlite] help

2012-04-23 Thread Simon Davies
2012/4/23 Ковригина Ольга kofa_...@mail.ru: Hello,support! Tell me how to resize columns in a table? I do like this: ALTER TABLE t1 MODIFY (c1 TYPE VARCHAR(2500)); or ALTER TABLE t1 ALTER (c1 TYPE VARCHAR(2500)); But it does not work. The column does not have a size:

Re: [sqlite] Is it possible to preclude the latest sqlite 3.7.11 Windows warning message?

2012-04-23 Thread Simon Davies
On 23 April 2012 13:04, Frank Chang frank_chan...@hotmail.com wrote:       Good morning, We are trying to compile  the latest SQLITE 3.7.11 release but we keep getting the Windows Visual Studio 8 warning message: warning C4232: nonstandard extension used : 'pCurrent' : address of

Re: [sqlite] sqlite3_transaction can't work

2012-04-05 Thread Simon Davies
On 5 April 2012 09:44, YAN HONG YE yanhong...@mpsa.com wrote: sqlite3_transaction trans(db); can't work in c, I don't know why? Give us a clue: what are you expecting, and what actually happens... Regards, Simon ___ sqlite-users mailing list

Re: [sqlite] SQLITE Binding Issue when using [] brackets

2012-04-02 Thread Simon Davies
On 1 April 2012 21:23, ap a...@solarrain.com wrote: http://sqlite.org/c3ref/bind_blob.html Brackets are recommended for attribute names in some cases, it seems the binding for :VVV does not permit :[VVV]. Is this the case? Square brackets are a quoting mechanism for identifiers supported for

Re: [sqlite] put jpg into sqlite database

2012-03-30 Thread Simon Davies
On 30 March 2012 10:39, YAN HONG YE yanhong...@mpsa.com wrote: this following code is my import girl.jpg to my sqlite database, but I don't know why JPG didn't up to the bin.db. #include string.h #includestdio.h #includestdlib.h #includesqlite3.h #pragma comment(lib, sqlite3.lib)

Re: [sqlite] how to add time in a new column

2012-03-29 Thread Simon Davies
On 29 March 2012 12:36, Black, Michael (IS) michael.bla...@ngc.com wrote: You'll need to export the table and data.  Change the SQL to what you want. Then import again. Does the shell have ability to name the columns on the insert  statements from the .dump to make this easier?  I don' t

Re: [sqlite] .headers error

2012-03-27 Thread Simon Davies
On 27 March 2012 06:03, YAN HONG YE yanhong...@mpsa.com wrote: C:\sqlite\libsqlite3 -html foods.db select * from dzh; mm.html -headers on sqlite3: Error: too many options: -headers on Use -help for a list of options. how to write this command? sqlite3 -html -header foods.db select * from

Re: [sqlite] version 3.7.3 on linux, commands do not respond

2012-03-22 Thread Simon Davies
2012/3/22 Conxita Marín cma...@dims.com: It has to be something more complexof course, I tried the same database in Debian Lenny + Sqlite3 3.5.9 and it works perfectly: conxita@my_other_linux# sqlite3 backup_bd SQLite version 3.5.9 Enter .help for instructions sqlite .tables

Re: [sqlite] Join-source issue when using sub '(' join-source ')'

2012-03-19 Thread Simon Davies
On 19 March 2012 13:05, Pavel Ivanov paiva...@gmail.com wrote: According to the documentation on SELECT statements http://www.sqlite.org/lang_select.html It seems possible to write join chains as A join (B join C). (using a '(' join-source ')' single-source ) ... It seems that parsing is

Re: [sqlite] The number of parameters passed to user functions

2012-03-13 Thread Simon Davies
On 13 March 2012 10:59, Max Vlasov max.vla...@gmail.com wrote: Hi, Is there a way to know the number of parameters passed for user function with undefined argument count (nArg = -1 in the Sqlite3_create_function call). I could not find a function specific to this task and thought that I at

Re: [sqlite] import txt file to sqlite

2012-03-12 Thread Simon Davies
On 12 March 2012 08:35, YAN HONG YE yanhong...@mpsa.com wrote: I wanna import a text file to sqlite db, this follow code is right?        char *zErrMsg = 0;        sqlite3 *db;        rc=sqlite3_open(foods.db,db);        sqlite3_exec(db, CREATE TABLE contact (fliename varchar(128) UNIQUE,

Re: [sqlite] Unique qualifier

2012-03-12 Thread Simon Davies
On 12 March 2012 15:49, Bryce Lembke bry...@vpieng.com wrote: I cannot seem to get the UNIQUE constraint to work in sqlite. The following is the trace from my command line. Note that if I remove the UNIQUE constraint, it works fine. C:\sqlite myDB.db SQLite version 3.6.17 Enter .help

Re: [sqlite] Efficient random sampling in a large table using builtin functions.

2012-03-08 Thread Simon Davies
On 8 March 2012 14:20, Black, Michael (IS) michael.bla...@ngc.com wrote: You don't say what language you are working in.  IN C++ I would just declare a set and put random row numbers in it until I had enough.  Then use that set to build the SQL. SQLite's random() doesn't have a seed

Re: [sqlite] Efficient random sampling in a large table using builtin functions.

2012-03-08 Thread Simon Davies
...@sqlite.org] on behalf of Simon Davies [simon.james.dav...@gmail.com] Sent: Thursday, March 08, 2012 8:33 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] Efficient random sampling in a large table using builtin functions. On 8 March 2012 14:20, Black, Michael

Re: [sqlite] Views and Performance

2012-03-02 Thread Simon Davies
On 2 March 2012 16:23, Duquette, William H (318K) william.h.duque...@jpl.nasa.gov wrote: Howdy! Suppose I have two related tables, t1 and t2, and I write a view like this:    CREATE VIEW myview AS SELECT * FROM t1 JOIN t2 USING (some_column); If I am querying data just from t1, is there a

Re: [sqlite] read each line in sqlite database

2012-03-01 Thread Simon Davies
On 1 March 2012 08:44, YAN HONG YE yanhong...@mpsa.com wrote: I have a sqlite database named bb: Name    Price1    Price2    Slevel A1        23             231          NULL A2        22            12             NULL A3       21            223           NULL My question is: I want to

Re: [sqlite] SELECT COUNT (DISTINCT column_name FROM table)

2012-03-01 Thread Simon Davies
On 1 March 2012 09:22, Sreekumar TP sreekumar...@gmail.com wrote: doesnt work either. In what way does it fail to live up to your expectations? Regards, Simon ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] SELECT COUNT (DISTINCT column_name FROM table)

2012-03-01 Thread Simon Davies
On 1 March 2012 09:34, Petite Abeille petite.abei...@gmail.com wrote: On Mar 1, 2012, at 10:29 AM, Simon Davies wrote: doesnt work either. In what way does it fail to live up to your expectations? Simon? Are you impersonating Igor?!? :D LOL

Re: [sqlite] read each line in sqlite database

2012-03-01 Thread Simon Davies
On 1 March 2012 18:43, Don V Nielsen donvniel...@gmail.com wrote: I think Simon's solution is in error, and Igor's is correct.  In Simon's case, Slevel will be set to 1 if price1 is greater than 30. It will be set to 2, as required by OP. However, the original c function would set Slevel to

Re: [sqlite] How to JOIN...

2012-02-22 Thread Simon Davies
On 22 February 2012 18:05, Danilo Cicerone cyds...@gmail.com wrote: ...two views. According to the following SQL statement(see below) I'm going to create a table 'A' storing student's name, table 'B' storing courses and table D storing cards. Furthermore, it creates two pivot tables A2B and

Re: [sqlite] SQL help

2011-12-22 Thread Simon Davies
On 22 December 2011 15:08, Paul Sanderson sandersonforens...@gmail.com wrote: Hi I have a large table with some duplicate rows that I want to delete. Essentially I have two columns, one containing a date and one containing a number. The number column can contain duplicates. For any row

Re: [sqlite] Command line option equivalent for .read

2011-12-08 Thread Simon Davies
On 8 December 2011 17:05, David Walker dav...@datamgmt.com wrote: Hi, Having played around with a shell script that calls SQLite I have noticed that I can something like        .separator STRING      at the SQLite prompt        .mode line or I can do        sqlite3 -separator STRING at

Re: [sqlite] Smart merge

2011-11-23 Thread Simon Davies
On 23 November 2011 11:23, nadavius nadav...@yahoo.com wrote: Hi guys, I have two tables T1, T2 - identical in fields [Index1 (INT), Index2(INT), Count(INT), Value(INT)] I would like to merge the content of T1 into T2 using the following ruels: 1. Copy into T2 data from T1 where Index1 AND

Re: [sqlite] sqlite command shell - read/process file then exit?

2011-11-21 Thread Simon Davies
On 21 November 2011 13:41, SupportLists supportli...@qlands.com wrote: Hi, I am trying to use sqlite3 command shell with -init filename. The file has: CREATE TABLE griddata (id_suit VARCHAR(14) PRIMARY KEY,xpos DECIMAL(7),ypos DECIMAL(7),cellvalue DECIMAL(14,5) DEFAULT -); .separator

Re: [sqlite] Cannot compile extension-functions.c

2011-11-09 Thread Simon Davies
On 7 November 2011 21:58, Richard D Watkins richard.d.watk...@seagate.com wrote: I am trying to compile    extension-functions.py   so that I may use the stdev function in SQLite queries. However, I keep getting errors that indicate failure to compile. First, I compiled the code for pysqlite,

Re: [sqlite] Question re use of column alias in SELECT

2011-10-22 Thread Simon Davies
On 22 October 2011 17:28, Pete p...@mollysrevenge.com wrote: If I have a SELECT statement like: SELECT cola, colb, sum(tableb.colc * tableb.cold) AS Total FROM TableA GROUP BY cola ORDER BY Total What is tableb? ...I get an error, I think because of referring to Total in the ORDER BY

Re: [sqlite] Fast JOIN

2011-10-18 Thread Simon Davies
On 18 October 2011 22:09, Fabian fabianpi...@gmail.com wrote: I'm working on a pagination system where two tables need to be joined. . . . I got very good advice on this mailing-list, to change the query into this: SELECT table1.data1, table2.data2 FROM ( SELECT table1.data1 WHERE

Re: [sqlite] Select Multiple rows in one row

2011-10-15 Thread Simon Davies
On 15 October 2011 12:20, Madhan Kumar askmad...@gmail.com wrote: Hi.    I have two Tables with the follwing structure *EmpTable* Empid* * Empname 1        * Raja * 2        Kumar *DeptTable* Deptid    Deptname    Empid 101   * xxx*     1 102     *yyy*    1 103    *zzz*    1

Re: [sqlite] importing CSV data on command-line?

2011-10-14 Thread Simon Davies
On 14 October 2011 15:17, James Hartley jjhart...@gmail.com wrote: When attempting to import CSV data, the shell balks at the command-line but is otherwise fine when all is done interactively.  I suspect user error, but I just don't see it. Any insight shared would be greatly appreciated. I am

Re: [sqlite] Faulty acceptance of non-aggregate value that is not in group by part of the SELECT statement

2011-10-11 Thread Simon Davies
Frank Missel fr...@missel.sg wrote: I would have expected an error message here to the effect that a non aggregate value was not part of the grouping. This subject has arisen before: http://www.mail-archive.com/sqlite-users@sqlite.org/msg63900.html Regards, Simon

Re: [sqlite] sort a contenated value as inserting

2011-09-29 Thread Simon Davies
On 29 September 2011 07:35, guiz guizaw...@gmail.com wrote: I have as the followings... create table t ([a] varchar(3), [b] varchar(3)); insert into t(a, b) values('6', '2'); insert into t(a, b) values('5', '3'); insert into t(a, b) values('2', '3'); create table t2([x] varchar(9));

Re: [sqlite] Suggest some Tools for Sqlite

2011-08-18 Thread Simon Davies
On 18 August 2011 08:44, Madhankumar Rajaram maraja...@technip.com wrote: Hi,         I am working on sqlite3 using command prompt. Its very hard to see the tables and datas. I hope there should be some good Free or Licence Tools for using Sqlite. For ex : Toad for Oracle. so, Kindly

Re: [sqlite] %Q vs. %q

2011-08-08 Thread Simon Davies
On 8 August 2011 10:45, Baruch Burstein bmburst...@gmail.com wrote: Sorry, I meant sqlite3_mprintf On Mon, Aug 8, 2011 at 12:40 PM, Simon Slavin slav...@bigfraud.org wrote: On 8 Aug 2011, at 10:35am, Baruch Burstein wrote: What is the difference between mprintf(insert into a

Re: [sqlite] Compute percentage?

2011-06-29 Thread Simon Davies
On 29 June 2011 11:34, Gilles Ganault gilles.gana...@free.fr wrote: On Wed, 29 Jun 2011 11:33:15 +0200, Roger Andersson r...@telia.com wrote: SELECT (COUNT(rowid)*100)/(select count(*) from people) FROM people WHERE zip=12345; Thanks, that worked: SELECT COUNT(*) FROM people; 400599

Re: [sqlite] Functions and index

2011-06-27 Thread Simon Davies
On 27 June 2011 16:16, hilaner hila...@poczta.onet.pl wrote: I have hundred thousands of records in this table: CREATE TABLE days (        day_id INTEGER NOT NULL PRIMARY KEY,        day_date DATE ); CREATE INDEX day_i ON days (day_date ASC); And then if I run such query: EXPLAIN QUERY

Re: [sqlite] case_sensitive_like pragma not returning a value

2011-06-08 Thread Simon Davies
On 8 June 2011 08:50, John Quincy j.quinc...@yahoo.com wrote: Hi, from my experience the query PRAGMA case_sensitive_like; doesn't return the pragma's current value. I suppose this is the intended behavior but I'd like a confirmation since I can't find an answer in the docs.

Re: [sqlite] SQlite on delete trigger error

2011-05-19 Thread Simon Davies
On 19 May 2011 07:16, Support Lists supportli...@qlands.com wrote: Hi, I have the following sqlite trigger: / /|/CREATE TRIGGER DLT_actymethods_ibfk_1 BEFORE DELETE ON activity FOR EACH ROW BEGIN DELETE FROM actymethods WHERE ACTY_COD = OLD.ACTY_COD; END/ |So before delete the row from the

Re: [sqlite] Storing data with SQLite

2011-03-09 Thread Simon Davies
On 9 March 2011 08:54, liran ritkop rejt...@bgu.ac.il wrote: . . . I upload a file which contain the important lines in my code. The result in the blob data, as i said, is 32 bytes, which means 32 chars: 0123456789:;=?@ABCDEFGHIJKLMNO http://old.nabble.com/file/p31104442/toUpload.c

Re: [sqlite] Subquery syntax

2011-03-08 Thread Simon Davies
On 8 March 2011 05:05, Beppe giuseppecosta...@gmail.com wrote: Hi all, I have this query that work fine SELECT products.product_id, (SELECT SUM(quantity) FROM transactions WHERE transactions.product_id = products.product_id AND transactions.flow = 1) AS loaded, (SELECT SUM(quantity) FROM

Re: [sqlite] sqlite3 : error while converting .sql to .db

2011-03-08 Thread Simon Davies
On 8 March 2011 17:20, Nicolas Sarrasin azb...@hotmail.com wrote: Hi all, I'm new to SQLite and I'm actually trying to convert a .sql script to a .db file. I encounter a problem with this code : CREATE TABLE IF NOT EXISTS mytable(  NAME char(100) NOT NULL DEFAULT '',  p1 smallint(5)

Re: [sqlite] Help with a query

2011-03-04 Thread Simon Davies
On 4 March 2011 10:10, Marco Bambini ma...@sqlabs.net wrote: Hello, I have a table defined as: CREATE TABLE MKProperties (id INTEGER PRIMARY KEY AUTOINCREMENT, obj_id INTEGER, prop_key TEXT, prop_value TEXT, UNIQUE(obj_id, prop_key)) In that table there some rows like: obj_id  prop_key    

Re: [sqlite] Ideas for Searching Names in Contacts

2011-02-23 Thread Simon Davies
On 23 February 2011 15:48, Mohit Sindhwani m...@onghu.com wrote: I am trying to build a simple contacts database in SQLite. I want people to be able to search starting with any word of the name. So, if I have: 1,John Smith 2,Simon James 3,Simon Kelly Smith 4,Jimmy Garcia 5,Smith White

Re: [sqlite] Pivot table from multiple columns

2011-02-16 Thread Simon Davies
On 16 February 2011 23:00, Joe Bennett jammer10...@gmail.com wrote: OK, this looks like it concatenated Column_1 and Column_2 and returns the count of the new unique concatenated pair? What I am looking for (and I apologize for not being clear) is a list of the unique values (Column 1 and 2

Re: [sqlite] LENGTH on a BLOB field stops at NUL byte

2011-02-06 Thread Simon Davies
On 6 February 2011 10:40, Yves Goergen nospam.l...@unclassified.de wrote: Hi, I'm storing small files in a BLOB field in the database. I'd like to determine the size of such a file with an SQL query without fetching the data. I tried using the LENGTH() function on that field but it stops

Re: [sqlite] beginner question: help required to retrieve filename from an open sqlite3* handle

2011-02-04 Thread Simon Davies
On 4 February 2011 07:38, Andreas Otto aotto1...@t-online.de wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, with sqlite2_open the parameter filename is used to specify the database location. Q: how I can retrieve this parameter from an open handle?

Re: [sqlite] How can we use POWER(2,32) like function in SQLite

2011-01-20 Thread Simon Davies
On 20 January 2011 05:23, Sunil Bhardwaj sbhard...@ipolicynetworks.com wrote: Hi Please suggest, How can we use POWER(2,32) like function in SQLite? Vanilla SQL has no power function, but see extension-functions.c in http://sqlite.org/contrib. Thanks Sunil Bhardwaj Ext. 1125

Re: [sqlite] Date operations when date is a TEXT

2011-01-19 Thread Simon Davies
On 19 January 2011 10:06, Ian Hardingham i...@omroth.com wrote: Hey guys. Probably unwisely, I store dates in the following format: year month day hour minute For example: 11 1 4 16 22 I wish to find all rows in a table which are more than 8 days old.  Is there a way of doing this in

  1   2   3   4   >