On 28 Aug 2015, at 10:20am, Domingo Alvarez Duarte wrote:
> Please remember that the "random" function here is only a detail the real
> problem is the "column expression" been reevaluated more than once.
Yes. When considering fixes for this problem one needs to also consider
Now that we have solved the expression column reevaluation problem on the
"ORDER BY" clause what about the same problem on the "WHERE" clause ?
CREATE TABLE myTable (a INTEGER);
INSERT INTO myTable VALUES (1),(2),(3),(4),(5);
CREATE VIEW myView AS SELECT a,random()%100 AS rr FROM myTable;
OK, I am truly grateful for what I have learned in this thread! And I have
composed an new, personal, rule: don't use a function in _anything_ other
than in the column list portion of a SELECT statement. If necessary, this
means I will be using a CREATE TEMPORARY TABLE results type construct when
> On Nov 10, 2014, at 9:31 AM, Richard Hipp wrote:
>
> On Mon, Nov 10, 2014 at 12:28 PM, Ward Willats
> wrote:
>
>>
>>> On Nov 10, 2014, at 3:11 AM, Richard Hipp wrote:
>>>
>>> If you recompile the SQLite command-line shell
On Mon, Nov 10, 2014 at 12:28 PM, Ward Willats
wrote:
>
> > On Nov 10, 2014, at 3:11 AM, Richard Hipp wrote:
> >
> > If you recompile the SQLite command-line shell (sqlite3.exe) using the
> > -DSQLITE_ENABLE_SELECTTRACE option, then you can enter:
> >
>
> On Nov 10, 2014, at 3:11 AM, Richard Hipp wrote:
>
> If you recompile the SQLite command-line shell (sqlite3.exe) using the
> -DSQLITE_ENABLE_SELECTTRACE option, then you can enter:
>
If I do that,
gcc -D SQLITE_ENABLE_SELECTTRACE -D HAVE_READLINE -l readline -o
On 11/10/2014 4:40 AM, Prakash Premkumar wrote:
=
/\
salary+
/ \
3 3
/
*
/
On Mon, Nov 10, 2014 at 4:40 AM, Prakash Premkumar
wrote:
> The where clause in sqlite is encoded as a tree
>
> Let's say I have select statement like :
>
> SELECT * from employee where salary = 3+5*4+3;
>
> The tree which takes care of operator precedence is :
>
>
On 10 Nov 2014, at 9:40am, Prakash Premkumar wrote:
> If I am constructing this tree for where clause by myself, should i take
> the operator precedence in to account while constructing it or will sqlite
> take care of precedence,given any tree (i.e constructing it with
h.p...@gmail.com]
> Gesendet: Montag, 10. November 2014 10:40
> An: General Discussion of SQLite Database
> Betreff: [sqlite] SQLite where clause tree
>
> The where clause in sqlite is encoded as a tree
>
> Let's say I have select statement like :
>
> SELECT * from e
2014 10:40
An: General Discussion of SQLite Database
Betreff: [sqlite] SQLite where clause tree
The where clause in sqlite is encoded as a tree
Let's say I have select statement like :
SELECT * from employee where salary = 3+5*4+3;
The tree which takes care of operator precedence
The where clause in sqlite is encoded as a tree
Let's say I have select statement like :
SELECT * from employee where salary = 3+5*4+3;
The tree which takes care of operator precedence is :
=
/\
salary+
On 05/10/2013 6:01 AM, Clemens Ladisch wrote:
Bao Niu wrote:
SELECT * FROM myTable WHERE MyDate > MyModule.ChineseDate("兔年八月十五")
You cannot use Python function directly in SQL.
... but you can register it with sqlite3 easily enough and use it from
SQL afterward:
Bao Niu wrote:
> SELECT * FROM myTable WHERE MyDate > MyModule.ChineseDate("兔年八月十五")
You cannot use Python function directly in SQL.
You have to convert from the Python type to the corresponding SQL type.
I don't know how the type mapping works exactl, but it should probably
look like this:
I coded a module that has a ChineseDate class, which automatically parse
Chinese dates characters into a python-dateutil object(which actually is a
datetime.datetime object as well).
I used detect_types=sqlite3.PARSE_DECLTYPES to tell the connection object
to store this ChineseDate type directly
]);
}
}
-Ursprüngliche Nachricht-
Von: techi eth [mailto:techi...@gmail.com]
Gesendet: Freitag, 09. August 2013 07:24
An: General Discussion of SQLite Database
Betreff: Re: [sqlite] Where Clause
> BEGIN;
> SELECT COUNT() FROM WHERE ;
> if count == 0
> rai
t; -Ursprüngliche Nachricht-
> Von: techi eth [mailto:techi...@gmail.com]
> Gesendet: Freitag, 02. August 2013 13:13
> An: General Discussion of SQLite Database
> Betreff: Re: [sqlite] Where Clause
>
> I was checking for Update only if condition will match.
>
> I
On Fri, 2 Aug 2013 14:04:40 +0530
techi eth wrote:
> At the end of execution I am expecting SET will change the value but it
> actually doesn't SET the value due to wrong condition.
>
> I will check return from sqlite3 & due to success return I am in wrong
> assumption.
On 02.08.2013 10:14, techi eth wrote:
Come across one issue with conditional query execution.
Query: UPDATE COMPANY SET Name= 'test' WHERE ID = 2;
According to my understanding if no ID = 2 is present in table then error
should return but it return with SQLITE_OK however Name value is not
Discussion of SQLite Database
Betreff: Re: [sqlite] Where Clause
I was checking for Update only if condition will match.
In fact it can be any operation like SELECT,INSERT,UPDATE or DELETE
I think hint given by you using count() function will do the required.
So here If condition matches then count
; COMMIT
>
> -Ursprüngliche Nachricht-
> Von: techi eth [mailto:techi...@gmail.com]
> Gesendet: Freitag, 02. August 2013 12:36
> An: General Discussion of SQLite Database
> Betreff: Re: [sqlite] Where Clause
>
> Is their any Query format which can change the valu
: [sqlite] Where Clause
Is their any Query format which can change the value based on conditional
expression is TRUE!!!
Thanks..
Techi -
On Fri, Aug 2, 2013 at 2:11 PM, Hick Gunter <h...@scigames.at> wrote:
> The SQL you gave translates to
>
> "Change the 'Name' field to
ion;
> } else {
> error = unlock( file );
> if (error) raise exception;
> }
> }
>
> HTH
> Gunter
>
> -Ursprüngliche Nachricht-
> Von: techi eth [mailto:techi...@gmail.com]
> Gesendet: Freitag, 02. August 2013 1
Hi,
You expected the database to perform the assignment on each row WHERE ID = 2.
It did exactly this.
--
kind regards
- Roland Wilczek
Am Freitag, 2. August 2013, 14:04:40 schrieb techi eth:
> At the end of execution I am expecting SET will change the value but it
> actually doesn't SET the
if (error) raise exception;
}
}
HTH
Gunter
-Ursprüngliche Nachricht-
Von: techi eth [mailto:techi...@gmail.com]
Gesendet: Freitag, 02. August 2013 10:15
An: General Discussion of SQLite Database
Betreff: [sqlite] Where Clause
Come across one issue with conditional query execu
At the end of execution I am expecting SET will change the value but it
actually doesn't SET the value due to wrong condition.
I will check return from sqlite3 & due to success return I am in wrong
assumption.
On Fri, Aug 2, 2013 at 1:57 PM, Igor Korot wrote:
> Hi
> Why do
Hi
Why do you think it should return error?
On Aug 2, 2013 1:15 AM, "techi eth" wrote:
> Come across one issue with conditional query execution.
>
> Query: UPDATE COMPANY SET Name= 'test' WHERE ID = 2;
> According to my understanding if no ID = 2 is present in table then
Come across one issue with conditional query execution.
Query: UPDATE COMPANY SET Name= 'test' WHERE ID = 2;
According to my understanding if no ID = 2 is present in table then error
should return but it return with SQLITE_OK however Name value is not
changed.
Cheers -
Techi
On 1 Jul 2011, at 12:06am, Simon Gornall wrote:
> On 30 Jun 2011, at 14:13, Simon Slavin wrote:
>
>> On 30 Jun 2011, at 8:06pm, Simon Gornall wrote:
>>
>>> So, the goal is to maximise the number of times the 3rd-pass style can be
>>> what is actually being used. At the moment, if an entity
On 30 Jun 2011, at 14:13, Simon Slavin wrote:
>
> On 30 Jun 2011, at 8:06pm, Simon Gornall wrote:
>
>> So, the goal is to maximise the number of times the 3rd-pass style can be
>> what is actually being used. At the moment, if an entity gets *any* write
>> operation, I discard *all* entries
On 30 Jun 2011, at 8:06pm, Simon Gornall wrote:
> So, the goal is to maximise the number of times the 3rd-pass style can be
> what is actually being used. At the moment, if an entity gets *any* write
> operation, I discard *all* entries in the result-cache for that object.
I think you're
On 30 Jun 2011, at 11:42, Simon Slavin wrote:
>
> On 30 Jun 2011, at 7:28pm, Simon Gornall wrote:
>
>> I don't care if an update is made to the *value* of 'otherColumnName'. I
>> only care if the set-of-objects-that-would-be-returned could differ, not the
>> properties of those objects.
>
>
On 30 Jun 2011, at 7:28pm, Simon Gornall wrote:
> I don't care if an update is made to the *value* of 'otherColumnName'. I only
> care if the set-of-objects-that-would-be-returned could differ, not the
> properties of those objects.
Do a
SELECT group_concat(rowid) WHERE …
when you do your
On 30 Jun 2011, at 11:06, Igor Tandetnik wrote:
> On 6/30/2011 1:43 PM, Simon Gornall wrote:
>> Well, perhaps I'm missing something, but if the statement for which I'm
>> caching results was something like
>>
>> SELECT * FROM tableName WHERE columnName = zzz;
>>
>> I'd only want to clear
On 6/30/2011 1:43 PM, Simon Gornall wrote:
> Well, perhaps I'm missing something, but if the statement for which I'm
> caching results was something like
>
> SELECT * FROM tableName WHERE columnName = zzz;
>
> I'd only want to clear the results cache when statements like:
>
> UPDATE
On 30 Jun 2011, at 10:28, Igor Tandetnik wrote:
> On 6/30/2011 1:15 PM, Simon Gornall wrote:
>> Is it possible to get the columns operated on by a WHERE clause from the
>> sqlite3_stmt once it's been prepared ?
>>
>> I looked at the sqlite3_set_authorizer, but it doesn't seem to have
>> an
On 6/30/2011 1:15 PM, Simon Gornall wrote:
> Is it possible to get the columns operated on by a WHERE clause from the
> sqlite3_stmt once it's been prepared ?
>
> I looked at the sqlite3_set_authorizer, but it doesn't seem to have
> an action code for examining WHERE - the only codes that use
>
On Thu, Jun 30, 2011 at 1:15 PM, Simon Gornall wrote:
>
> I'm trying to intelligently invalidate cached results after a database
> UPDATE, where the results are cached by query.
Would the update_hook be helpful here?
http://www.sqlite.org/c3ref/update_hook.html
--
Hi there,
Is it possible to get the columns operated on by a WHERE clause from the
sqlite3_stmt once it's been prepared ?
I'm trying to intelligently invalidate cached results after a database UPDATE,
where the results are cached by query. One of the ways the query can be
instantiated is
On 14 Sep 2010, at 2:57pm, Jay A. Kreibich wrote:
> On Tue, Sep 14, 2010 at 06:52:02AM -0700, Rich Shepard scratched on the wall:
>> sqlite> select distinct state from Companies;
>> 'ID'
>> 'NV'
>> 'OR'
>> 'UT'
>> 'WA'
>
> If that's a copy-paste from a default sqlite3 session, the single
>
On 14 September 2010 14:52, Rich Shepard wrote:
> sqlite> select distinct state from Companies;
> 'ID'
> 'NV'
> 'OR'
> 'UT'
> 'WA'
It looks like the values in your db have quotes in them.
sqlite> create table companies(state char(2), name char(10));
sqlite> insert into companies
On Tue, Sep 14, 2010 at 06:52:02AM -0700, Rich Shepard scratched on the wall:
> On Tue, 14 Sep 2010, Paul Corke wrote:
>
> > What do you get from:
> >
> > select distinct state from companies;
>
> Paul,
>
> sqlite> select distinct state from Companies;
> 'ID'
> 'NV'
> 'OR'
> 'UT'
> 'WA'
If
On Tue, Sep 14, 2010 at 06:45:24AM -0700, Rich Shepard scratched on the wall:
>I cannot select rows from a table using the WHERE clause and cannot find
> my error. Perhaps others will see what I miss.
>
>The table, Companies, has 1500+ rows. One column is defined as
>state
On 14 September 2010 14:45, Rich Shepard wrote:
> sqlite> select * from Companies where state = 'OR';
What do you get from:
select distinct state from companies;
Paul.
___
sqlite-users mailing list
sqlite-users@sqlite.org
I cannot select rows from a table using the WHERE clause and cannot find
my error. Perhaps others will see what I miss.
The table, Companies, has 1500+ rows. One column is defined as
state CHAR(2),
but the select statement seeking all rows where state = 'OR' for example
returns
Aha. Got it. After
PRAGMA case_sensitive_like =1
the optimizer might use the index with BINARY collation.
I was under the mistaken impression that LIKE() adapted itself to the
column's collation. But I see that it is not possible to define one
column to use BINARY collation and another
On Mon, Nov 30, 2009 at 08:28:12PM -0500, Tim Romano scratched on the wall:
> On my system, an index is used with the query above only when collation
> is "collation nocase".
In other words, when LIKE and collation agree on what "equal" is.
> I /believe/ case_sensitive_like is OFF. I've
Tim Romano wrote:
> A revised question (sorry for leaving out an important fact on the
> first go):
>
> When the default binary collation is being used, why does the
> optimizer not attempt to use an index when the WHERE
> clause uses the LIKE operator with a text column,
A revised question (sorry for leaving out an important fact on the first go):
When the default binary collation is being used, why does the optimizer not
attempt to use an index when the WHERE
clause uses the LIKE operator with a text column, as in:
... where myTextColumn like 'M%'
On my
On Mon, Nov 30, 2009 at 08:56:48PM +, Simon Slavin wrote:
> On 30 Nov 2009, at 6:49pm, Nicolas Williams wrote:
> > See my previous message: it would make no sense to have a column with
> > data-dependent collations. But perhaps I'm missing something. Can you
> > describe the semantics of
Tim Romano wrote:
> Why does the optimizer not attempt to use an index when the WHERE
> clause uses the LIKE operator with a text column, as in:
>
> ... where myTextColumn like 'M%'
It does, when certain conditions are met. See
http://sqlite.org/optoverview.html ,
Why does the optimizer not attempt to use an index when the WHERE clause
uses the LIKE operator with a text column, as in:
... where myTextColumn like 'M%'
My question ultimately concerns Unicode and indexing, and since these
subjects are being discussed *passim* in this thread, I hope you
On 30 Nov 2009, at 6:49pm, Nicolas Williams wrote:
> On Mon, Nov 30, 2009 at 06:37:11PM +, Simon Slavin wrote:
>>
>
>> The column 'language'
>> could perhaps be absolute, or perhaps be used as a default if the
>> individual values did not declare a language. On the other hand, it
>> might
On Mon, Nov 30, 2009 at 06:37:11PM +, Simon Slavin scratched on the wall:
>
> On 30 Nov 2009, at 5:51pm, Nicolas Williams wrote:
>
> > Consider a column that contains a person's last name. Q: do proper
> > names have a language? A: No, since people can be from all over and
> > even within
Simon Slavin wrote:
> But what is the purpose of collating a column ? Why, to allow it to be
> indexed, of course. And for it to be indexed every value in the column must
> be comparable to every other value. So it might be sufficient to simply
> declare the column as having a language:
>
>
On Mon, Nov 30, 2009 at 06:37:11PM +, Simon Slavin wrote:
>
> On 30 Nov 2009, at 5:51pm, Nicolas Williams wrote:
>
> > Consider a column that contains a person's last name. Q: do proper
> > names have a language? A: No, since people can be from all over and
> > even within a single country
On Mon, Nov 30, 2009 at 01:21:08PM -0500, Igor Tandetnik wrote:
> Nicolas Williams wrote:
> > IMO you'll have two types of text to sort: a) generic text (e.g.,
> > proper names), b) localized text (e.g., message catalogs). For (a)
> > you'll want
> > to pick a
On 30 Nov 2009, at 5:51pm, Nicolas Williams wrote:
> Consider a column that contains a person's last name. Q: do proper
> names have a language? A: No, since people can be from all over and
> even within a single country may have last names of various radically
> different origins.
But what
Nicolas Williams wrote:
> IMO you'll have two types of text to sort: a) generic text (e.g.,
> proper names), b) localized text (e.g., message catalogs). For (a)
> you'll want
> to pick a collation, _any_ collation.
Actually, you may want to choose a collation familiar
On Mon, Nov 30, 2009 at 08:15:58AM +, Simon Slavin wrote:
> On 30 Nov 2009, at 1:58am, Igor Tandetnik wrote:
> > Note that Unicode collation is not as simple as you might think. Did
> > you know that in Estonian, 'y' sorts between 'i' and 'j'? Or that in
> > German phonebook sort, 'oe' sorts
On 30 Nov 2009, at 1:58am, Igor Tandetnik wrote:
> Note that Unicode collation is not as simple as you might think. Did you know
> that in Estonian, 'y' sorts between 'i' and 'j'? Or that in German phonebook
> sort, 'oe' sorts as if it were a single letter between 'o' and 'p'?
> Basically,
Irshad Alam wrote:
> I want to use WHERE Clause for unicode search in database. Let me clear more
> about my requirement. Suppose I've a database whose table name is employee
> having name, age and salary as three columns.
>
> Now I want to make query on employee table which gives the result
>Now I want to make query on employee table which gives the result having
>names start between 'D' and 'M', so probable I'll do something " SELECT *
>FROM employee WHERE name BETWEEN 'd%' AND 'n%' ". But this is very
>specific
>if I know the characters. I want to avoid using the character and
I want to use WHERE Clause for unicode search in database. Let me clear more
about my requirement. Suppose I've a database whose table name is employee
having name, age and salary as three columns.
Now I want to make query on employee table which gives the result having
names start between 'D'
On Mar 13, 2009, at 10:10 PM, Fitter Man wrote:
>
> @John: Is that documented anywhere? I ask because there are some
> cases I'd
> like to understand better without going through a lot of testing to
> determine how it works. I'm inferring from your example the rule is
> all
> numerics come
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] WHERE clause doesn't seem to work right
@John: Is that documented anywhere? I ask because there are some cases I'd
like to understand better without going through a lot of testing to
determine how it works. I'm inferring from your example the rule
@John: Is that documented anywhere? I ask because there are some cases I'd
like to understand better without going through a lot of testing to
determine how it works. I'm inferring from your example the rule is all
numerics come first, with integer and floats interleaved according to their
Fitter Man wrote:
> I tried something for kicks and it worked. I flipped all the column
> definitions from VARCHAR(255) to INTEGER and my query, above, works
> properly. I did a little reading and found this described my problem:
> http://www.sqlite.org/datatypes.html .
>
>
> Q: Is their some
I tried something for kicks and it worked. I flipped all the column
definitions from VARCHAR(255) to INTEGER and my query, above, works
properly. I did a little reading and found this described my problem:
http://www.sqlite.org/datatypes.html .
Q: Is their some inverse problem now that all the
Fitter Man wrote:
> I've just started using Sqlite and something seems wrong. I'm sure I'm making
> a mistake, but can't spot it.
>
> I have a process that loads data from an RSS feed into a database. All the
> columns are defined as VARCHAR(255) but I figure that's irrelevant here
> based on
Hello list,
I need to implement a security model where certain columns (e.g. named
super_secret_key) will be hidden.
This needs to be enforced not only for the requested result columns but
also for the columns referenced in the WHERE clause.
Is there a relatively simple way to either get
Unfortunately, for the SQLITE_SELECT action code
(http://www.sqlite.org/c3ref/c_alter_table.html) the registered auth
callback will not get the column information.
It is only available for SQLITE_READ, which, I guess, is not what I need
- I would like prepare statement to fail if there are "hidden
On Mar 3, 2009, at 8:18 PM, Alex Ousherovitch wrote:
> Hello list,
>
>
>
> I need to implement a security model where certain columns (e.g. named
> super_secret_key) will be hidden.
>
> This needs to be enforced not only for the requested result columns
> but
> also for the columns referenced
Hello list,
I need to implement a security model where certain columns (e.g. named
super_secret_key) will be hidden.
This needs to be enforced not only for the requested result columns but
also for the columns referenced in the WHERE clause.
Is there a relatively simple way to either get
James W. Walker wrote:
Let's say I have two tables A and B, each of which has an integer ID
column. I want to find ID values that occur in A but not B. The
first query I came up with was:
SELECT ID FROM A WHERE NOT EXISTS (SELECT * FROM B WHERE B.ID = A.ID);
but I get a syntax error. My
>Something like:
>
>SELECT A.ID
>FROM A
>LEFT JOIN B
>ON A.ID = B.ID
>WHERE B.ID IS NULL
>
>Might be more efficient?
Nope. I rewrote such query to SELECT ID FROM A WHERE ID NOT IN (SELECT ID FROM
B);
SELECT COUNT(*) AS unread FROM mboxes WHERE
idMbox = %d AND idMsg IN (SELECT idMsg FROM
Hello Stanislaw,
i think you may be mistaken. Indices in sqlite are implemented as trees.
If the where clause does not include column c, there is no way to use
the tree beyond the column b. The program has to look at every row that
meets the clauses involving a and b.
Also, in my
Hi
I have found following in 'The SQLite Query Optimizer Overview':
It is not necessary for every column of an index to appear in a WHERE
clause term in order for that index to be used. But there can not be
gaps in the columns of the index that are used. Thus for the example
index above, if
On Tue, 2005-09-06 at 13:07 -0700, R S wrote:
> Hi,
> I have a million records in my DB. I tried using .explain on and ran the
> query below which took a long time although I just want the last 100,000
> records...(It ran much faster when my table had a 100,000 records) so I
> assume it is
Hi,
I have a million records in my DB. I tried using .explain on and ran the
query below which took a long time although I just want the last 100,000
records...(It ran much faster when my table had a 100,000 records) so I
assume it is related to how I constructed the statement.
select columns
80 matches
Mail list logo