Re: [sqlite] Table name in attach'ed databases

2013-07-20 Thread Igor Tandetnik
On 7/20/2013 7:33 PM, Simon Slavin wrote: The problem here is that various tutorials have shown incorrect examples for the thing after the 'AS'. Some show it without quotes, and some show it with single quotes. If I understand correctly the intention of the developers is that the name

Re: [sqlite] Table name in attach'ed databases

2013-07-20 Thread Simon Slavin
On 21 Jul 2013, at 12:20am, Igor Tandetnik wrote: > On 7/20/2013 5:33 PM, V.Krishn wrote: >> following works: >> attach database 'file:test.db' as 'test'; #OK >> select * from test.employees limit 1; #OK >> >> but, >> attach database 'file:test.db' as '123test'; #OK >>

Re: [sqlite] Table name in attach'ed databases

2013-07-20 Thread V.Krishn
On Sunday, July 21, 2013 04:50:16 AM Igor Tandetnik wrote: > On 7/20/2013 5:33 PM, V.Krishn wrote: > > following works: > > attach database 'file:test.db' as 'test'; #OK > > select * from test.employees limit 1; #OK > > > > but, > > attach database 'file:test.db' as '123test'; #OK > > select *

Re: [sqlite] Anything like "select 7 as a, 8 as b, a / b as c; " possible whatsoever?

2013-07-20 Thread Igor Tandetnik
On 7/20/2013 7:04 PM, Mikael wrote: C is not a present column, but is the result of an expression involving A and B (namely, the expression A / B). Yes. And this is notable because...? Can you please take this into consideration and update the query you proposed? :)) In what way do you

Re: [sqlite] Table name in attach'ed databases

2013-07-20 Thread Igor Tandetnik
On 7/20/2013 5:33 PM, V.Krishn wrote: following works: attach database 'file:test.db' as 'test'; #OK select * from test.employees limit 1; #OK but, attach database 'file:test.db' as '123test'; #OK select * from 123test.employees limit 1; #Gives error Try select * from "123test".employees

Re: [sqlite] Anything like "select 7 as a, 8 as b, a / b as c; " possible whatsoever?

2013-07-20 Thread Mikael
Hi Igor, C is not a present column, but is the result of an expression involving A and B (namely, the expression A / B). Can you please take this into consideration and update the query you proposed? :)) Thanks, Mikael 2013/7/20 Igor Tandetnik > On 7/20/2013 9:54 AM,

Re: [sqlite] Anything like "select 7 as a, 8 as b, a / b as c; " possible whatsoever?

2013-07-20 Thread Igor Tandetnik
On 7/20/2013 3:29 PM, E.Pasma wrote: Op 20 jul 2013, om 16:13 heeft Igor Tandetnik het volgende geschreven: select id, a, b, a/b as c from ( SELECT id, (SELECT [very complex subselect here, that uses categories.id as input]) AS a, (SELECT [another very complex subselect here, that uses

Re: [sqlite] Table name in attach'ed databases

2013-07-20 Thread Kees Nuyt
On Sun, 21 Jul 2013 03:03:10 +0530, "V.Krishn" wrote: >following works: >attach database 'file:test.db' as 'test'; #OK >select * from test.employees limit 1; #OK > >but, >attach database 'file:test.db' as '123test'; #OK >select * from 123test.employees limit 1; #Gives error >

[sqlite] Table name in attach'ed databases

2013-07-20 Thread V.Krishn
following works: attach database 'file:test.db' as 'test'; #OK select * from test.employees limit 1; #OK but, attach database 'file:test.db' as '123test'; #OK select * from 123test.employees limit 1; #Gives error I hope this is not a bug ? (assuming here that table names starting with numeric is

Re: [sqlite] Anything like "select 7 as a, 8 as b, a / b as c; " possible whatsoever?

2013-07-20 Thread E.Pasma
Op 20 jul 2013, om 16:13 heeft Igor Tandetnik het volgende geschreven: On 7/20/2013 9:54 AM, Mikael wrote: So again, SELECT id, (SELECT [very complex subselect here, that uses categories.id as input]) AS a, (SELECT [another very complex subselect here, that uses categories.id as input])

Re: [sqlite] Using in-memory DBs of the form: of 20) "file:memdb1?mode=memory=shared" (via Perl, DBD::SQLite & DBI)

2013-07-20 Thread Simon Slavin
On 20 Jul 2013, at 3:11pm, sqlite.20.browse...@xoxy.net wrote: > this in-memory database actually persists. Ie. Beyond the life of the program > that created it. Then it's not an in-memory database. Have you obeyed the requirements: version 3.7.7 or above,

Re: [sqlite] Anything like "select 7 as a, 8 as b, a / b as c; " possible whatsoever?

2013-07-20 Thread Michael Black
Is this some mental exercise? Why can't you do this in the calling code rather than some funky SQL select? Or add a custom function? -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Mikael Sent: Saturday, July 20, 2013 8:54 AM

Re: [sqlite] Anything like "select 7 as a, 8 as b, a / b as c; " possible whatsoever?

2013-07-20 Thread Igor Tandetnik
On 7/20/2013 9:54 AM, Mikael wrote: So again, SELECT id, (SELECT [very complex subselect here, that uses categories.id as input]) AS a, (SELECT [another very complex subselect here, that uses categories.id as input]) AS b, a / b AS c FROM categories ORDER BY c; select id, a, b, a/b as c from

Re: [sqlite] Using in-memory DBs of the form: of 20) "file:memdb1?mode=memory=shared" (via Perl, DBD::SQLite & DBI)

2013-07-20 Thread sqlite . 20 . browseruk
Niall, I'm using a dbname of 'file:memdb2?mode=memory=shared' in order to allow several threads to connect to the same in-memory DB (per docs at: http://www.sqlite.org/inmemorydb.html). This works great! (And works around a dumb limitation od DBI/iThreads.) The problem is that (despite the

Re: [sqlite] Anything like "select 7 as a, 8 as b, a / b as c; " possible whatsoever?

2013-07-20 Thread Mikael
Ah I realize now I didn't write it out in the example, but by thing and thing2 I just allegorically wanted to represent a *very complex* subselect, so here we go more clearly: Inlining this subselect's SQL expression in the "A / B" part would make it need to execute once more, which would make it

Re: [sqlite] Anything like "select 7 as a, 8 as b, a / b as c; " possible whatsoever?

2013-07-20 Thread Luuk
On 20-07-2013 15:26, Mikael wrote: SELECT id, (SELECT thing FROM othertable WHERE othertable.something = categories.id) AS a, (SELECT thing2 FROM othertable2 WHERE othertable2.something2 = categories.id) AS b, a / b AS c FROM categories ORDER BY c; Is there any way whatsoever to do this?

Re: [sqlite] Anything like "select 7 as a, 8 as b, a / b as c; " possible whatsoever?

2013-07-20 Thread Mikael
Hi Clemens! Hmm. Let's see how this fits into the bigger picture: I have a table "categories". I'm doing a select for each of its id:s i.e: SELECT id FROM categories; Now, what I want to do is that I want to do two separate subselects that use categories.id for the respective row the

Re: [sqlite] Anything like "select 7 as a, 8 as b, a / b as c; " possible whatsoever?

2013-07-20 Thread Clemens Ladisch
Mikael wrote: > Is anything like "select 7 as a, 8 as b, a / b as c;" possible? Not directy, but you could use a subquery: SELECT *, a / b AS c FROM (SELECT 7 AS a, 8 AS b); Regards, Clemens ___ sqlite-users mailing list sqlite-users@sqlite.org

[sqlite] Anything like "select 7 as a, 8 as b, a / b as c; " possible whatsoever?

2013-07-20 Thread Mikael
Hi! Is anything like "select 7 as a, 8 as b, a / b as c;" possible? I.e., I select one value into one column and another into another (it's a subselect, expression etc.), and then I want to generate a separate column that's an expression involving both the earlier two generated values. Possibly