Hello,I tried this:q)trade:(time:();sym:();price:();size:())q)trade insert(09:30:00;
a;10.75;100),0q)tradetime sym price size-----------------------09:30:00 a 10.75 100q)s) insert into trade values (10:00:00,b,22.34,120)k){j::3;t:r 2;f:$["("~r j;l[i]n[];!+0!. t];t insert f!(@:'(0!. t)f)$-6!'l[a]r j::2+r?
values;}'`q))So, how do I insert a record using sql syntax into trade table?Further, I read in code.kx.com [1] that only a subset of SQL issupported. Some examples of what is not possible would help. I wouldlike to use the standard ones like CREATE TABLE, DROP TABLE, INSERT,UPDATE, SELECT to start with.Thanks,Yuva[1] https://code.kx.com/trac/wiki/Cookbook/UsingKdb#CanIwriteaqueryusingSQLsyntaxagainstqtables
> q)s) insert into trade values (10:00:00,b,22.34,120)for symbols you have to use sql syntax:q)s) insert into trade values (10:00:00,'b',22.34,120)check s.k for examples and documentation of capabilities (quite BNFlike though :))Regards, AttilaOn Fri, May 2, 2008 at 11:04 AM, Yuvaraj Athur Raghuvir<yuvaraj.a.r> wrote:>> Hello,>> I tried this:>> q)trade:([]time:();sym:();price:();size:())> q)
trade insert(09:30:00;a;10.75;100)> ,0> q)trade> time sym price size> -----------------------> 09:30:00 a 10.75 100> q)s) insert into trade values (10:00:00,
b,22.34,120)> k){j::3;t:r 2;f:$[“(”~r j;l[i]n;!+0!. t];t insert f!(@:'(0!. t)f)> $-6!'l[a]r j::2+r?values;}> '
> q))>> So, how do I insert a record using sql syntax into trade table?>> Further, I read in code.kx.com [1] that only a subset of SQL is> supported. Some examples of what is not possible would help. I would> like to use the standard ones like CREATE TABLE, DROP TABLE, INSERT,> UPDATE, SELECT to start with.>> Thanks,> Yuva>> [1] https://code.kx.com/trac/wiki/Cookbook/UsingKdb#CanIwriteaqueryusingSQLsyntaxagainstqtables>> >></yuvaraj.a.r>
Thanks.
I tried the following:
q)s) create table TRADE_REQUEST (TR_T_ID numeric(15) not null primary key, TR_RR_ID char(3) not null, TR_S_SYMB char(15) not null, TR_QTY numeric (6) not null, TR_BID_PRICE numeric(8,2) not null, TR_B_ID numeric(11) not null);
This generates the error:
k){j::3;c:+p l{(p;x;$[`references~r j+:2*p:`primary~r j+:3*`symbol=a:t@_i n;i n;a])};.[r[2];();:;(+/*c)!+c[1]!c[2]$:()];}
'type
+:
(,`TR_T_ID)!,`
I saw in s.k that numeric data type is not listed[1]. So, how to model numeric data type in q?
Regards,
Yuva
[1] t:(char
varchartinyint
smallintbigint
timestamp!symbol
symbolbyte
shortlong
datetime),t!t:boolean
intreal
floatdate
time
<1855e77f0805020312s7e4d843aq8291a792497a2401@mail.gmail.com>
<10505d5c0805050152r16382650n5fd517663ef6339e@mail.gmail.com>
Just choose the closest datatype
q)s) create table TRADE_REQUEST (TR_T_ID bigint primary key, TR_RR_ID
varchar(3), TR_S_SYMB varchar(15), TR_QTY int, TR_BID_PRICE float,
TR_B_ID bigint
Note that not null constrains are not supported.
Any particular reason you don’t want to use the much more powerful q?
Regards,
Attila
I am just starting to experiment with Kdb+/q. I have worked to some extent with J. I am slowly working through the tutorials and so some of the questions I ask may be due to low knowledge of q.
I am doing an experiment where in I am using the same SQL schema and populating a row-store and column-store(q). I was hoping that I would not have to change the basic SQL statements that I am using for the two stores. I am using J as the glue code for the two different stores.
But now I see that I would need a translation between the SQL statements I have to the q statements because the support in s.k is minimal :(.
-
I saw once using .z.f that ..\s.k is loaded into the environment and that parses the SQL statements. But I am not able to see how that happened!! And I am still figuring out the execution mechanism behind this.
-
For my purpose, I would then have to extend this script so that I can keep my driver code constant. It would be great if there is a verbose description of s.k so that I can extend it.
-
BTW, how do I debug??
The statements I would use are schema statements like described earlier, drop table, and simple table modifications using insert, update and delete. I am not able to quickly find how I can “drop” a table. This is for experimentation with SQL schemas.
Thanks for any pointers or clues,
Yuva
Hello,
I happened to get to q.doc on your site. Can you tell me where I can learn more about the following?
BNF (Expressions term Noun Verb Adverb Clauses) e:nve|te| t:n|v:tA|V
n:(<[E]>E)|{<[E]>E}|t[E:E;e|[E]]|N|{exec|select|update|delete}C<by C>
from e<where C:C,e>
parse: ([f|{}];x;,`s)
t insert x
?[t;c;b;a] /select,exec
![t;c;b;a] /update,delete
Thanks,
Yuva
> But now I see that I would need a translation between the SQL statements I> have to the q statements because the support in s.k is minimal :(.I think its purpose is not too provide a full SQL implementation, butjust to make interfacing for some clients a bit easier. Also (the codeto implement the SQL subset)/(usefulness of the SQL subset) is stillexceptionally. And in the end one should use q because it is much morepowerful/simple/more fun (see examples at end of s.k for example).> 1) I saw once using .z.f that ..\s.k is loaded into the environment and that> parses the SQL statements. But I am not able to see how that happened!! And> I am still figuring out the execution mechanism behind this.One can implement own languages for kdb+ in k (or q) by putting themin x.k (where x is a letter, obviously k, q and s are already taken)in $QHOME and calling them later on by x)… Personally I never heardof anybody else who did this apart from Kx Systems.> 2) For my purpose, I would then have to extend this script so that I can> keep my driver code constant. It would be great if there is a verbose> description of s.k so that I can extend it.You would have to know k4 and be familiar with this type of very tightcode. It would be a great intellectual exercise, but it is not easy.> 3) BTW, how do I debug??Debug s.k (see previous point)? Or debug in general? :http://kx.com/q/d/a/q.htm#Debug\> The statements I would use are schema statements like described earlier,> drop table, and simple table modifications using insert, update and delete.> I am not able to quickly find how I can “drop” a table. This is for> experimentation with SQL schemas.If you will have to do a translation anyway I would convert them to q- they should be trivial (in fact simpler)Regards, Attila
<1855e77f0805020312s7e4d843aq8291a792497a2401@mail.gmail.com>
<10505d5c0805050152r16382650n5fd517663ef6339e@mail.gmail.com>
<1855e77f0805050308w5d61647fic1c6a7e4df9a7c21@mail.gmail.com>
<10505d5c0805050401l5012cb6fp904191f817a53ba@mail.gmail.com>
<10505d5c0805070050q54204b21l473ed4ac3312d75b@mail.gmail.com>
What more do you want to know about the BNF? Does it matter at all for
you or it is just curiosity?
For functional queries and parse see code.kx.com and Q for Mortals in
particular: https://code.kx.com/trac/wiki/QforMortals2/queries\_q\_sql#Functional-Forms
Regards,
Attila
Thanks. I have started looking into using native q. Since I use an external driver, I will have to do the translation externally. And thats ok for my purposes.
One thing I have still not figured out - how to drop a table in q? My guess is that any reassignment to the table name variable will cause the entire table to get dropped. So, I could do:
q) EMP:([id:`int$()]name:`symbol$();empid:`long$()) \ will create the table variable EMP
q) \ … do some table operations…
q)EMP:0 \drops the table!
Right?
As typical in any new language learning, I am trying to map the expressions of the language I know (SQL) to the expressions of the language (q) I am learning. So, there!
Regards,
Yuva
apart from tables q also has atoms, vectors, lists, dictionaries, keyed tablesto properly delete any variable from a namespace:delete variable from namespacethe top-level namespace is ., so to delete a table from theredelete table from
.Regards, AttilaOn Sun, May 11, 2008 at 3:09 AM, Yuvaraj Athur Raghuvir<yuvaraj.a.r> wrote:> Thanks. I have started looking into using native q. Since I use an external> driver, I will have to do the translation externally. And thats ok for my> purposes.>> One thing I have still not figured out - how to drop a table in q? My guess> is that any reassignment to the table name variable will cause the entire> table to get dropped. So, I could do:> q) EMP:([id:`int$()]name:`symbol$();empid:`long$()) \ will create the table> variable EMP> q) \ … do some table operations…> q)EMP:0 \drops the table!>> Right?>> As typical in any new language learning, I am trying to map the expressions> of the language I know (SQL) to the expressions of the language (q) I am> learning. So, there!>> Regards,> Yuva>>>>>> On Sun, May 11, 2008 at 2:37 AM, Attila Vrabecz <attila.vrabecz>> wrote:> >> >> > > But now I see that I would need a translation between the SQL statements> I> > > have to the q statements because the support in s.k is minimal :(.> > I think its purpose is not too provide a full SQL implementation, but> > just to make interfacing for some clients a bit easier. Also (the code> > to implement the SQL subset)/(usefulness of the SQL subset) is still> > exceptionally. And in the end one should use q because it is much more> > powerful/simple/more fun (see examples at end of s.k for example).> >> >> > > 1) I saw once using .z.f that ..\s.k is loaded into the environment and> that> > > parses the SQL statements. But I am not able to see how that happened!!> And> > > I am still figuring out the execution mechanism behind this.> > One can implement own languages for kdb+ in k (or q) by putting them> > in x.k (where x is a letter, obviously k, q and s are already taken)> > in $QHOME and calling them later on by x)… Personally I never heard> > of anybody else who did this apart from Kx Systems.> >> >> > > 2) For my purpose, I would then have to extend this script so that I can> > > keep my driver code constant. It would be great if there is a verbose> > > description of s.k so that I can extend it.> > You would have to know k4 and be familiar with this type of very tight> > code. It would be a great intellectual exercise, but it is not easy.> >> >> > > 3) BTW, how do I debug??> > Debug s.k (see previous point)? Or debug in general? :> > http://kx.com/q/d/a/q.htm#Debug> >> >> > > The statements I would use are schema statements like described earlier,> > > drop table, and simple table modifications using insert, update and> delete.> > > I am not able to quickly find how I can “drop” a table. This is for> > > experimentation with SQL schemas.> > If you will have to do a translation anyway I would convert them to q> > - they should be trivial (in fact simpler)> >> > Regards,> > Attila> >> >> >> >> >> >>>>> >></attila.vrabecz></yuvaraj.a.r>
is it possible to combine recursion and grouping in a single query?for example say there is a table, t, with fieldsdate,time,class,score.how would one construct a query such that it returns every new maximumvalue in the score column grouped by date,class?i of course triedselect date,time,class,score by date,class from t where (maxsscore)>prev maxs score, but the result was not what i was lookingfor.i was able to get the correct answer by breaking the table intosmaller tables first (by date,class), and then applying a functionover the list smaller tables to handle the where clause part, but iwas hoping to find a better method.On May 11, 3:59 pm, “Attila Vrabecz” <attila.vrab…> wrote:> apart from tables q also has atoms, vectors, lists, dictionaries, keyed tables> to properly delete any variable from a namespace:> delete variable from namespace> the top-level namespace is ., so to delete a table from there> delete table from
.>> Regards,> Attila>> On Sun, May 11, 2008 at 3:09 AM, Yuvaraj Athur Raghuvir>> <yuvaraj…> wrote:> > Thanks. I have started looking into using native q. Since I use an external> > driver, I will have to do the translation externally. And thats ok for my> > purposes.>> > One thing I have still not figured out - how to drop a table in q? My guess> > is that any reassignment to the table name variable will cause the entire> > table to get dropped. So, I could do:> > q) EMP:([id:`int$()]name:`symbol$();empid:`long$()) \ will create the table> > variable EMP> > q) \ … do some table operations…> > q)EMP:0 \drops the table!>> > Right?>> > As typical in any new language learning, I am trying to map the expressions> > of the language I know (SQL) to the expressions of the language (q) I am> > learning. So, there!>> > Regards,> > Yuva>> > On Sun, May 11, 2008 at 2:37 AM, Attila Vrabecz <attila.vrab…>> > wrote:>> > > > But now I see that I would need a translation between the SQL statements> > I> > > > have to the q statements because the support in s.k is minimal :(.> > > I think its purpose is not too provide a full SQL implementation, but> > > just to make interfacing for some clients a bit easier. Also (the code> > > to implement the SQL subset)/(usefulness of the SQL subset) is still> > > exceptionally. And in the end one should use q because it is much more> > > powerful/simple/more fun (see examples at end of s.k for example).>> > > > 1) I saw once using .z.f that ..\s.k is loaded into the environment and> > that> > > > parses the SQL statements. But I am not able to see how that happened!!> > And> > > > I am still figuring out the execution mechanism behind this.> > > One can implement own languages for kdb+ in k (or q) by putting them> > > in x.k (where x is a letter, obviously k, q and s are already taken)> > > in $QHOME and calling them later on by x)… Personally I never heard> > > of anybody else who did this apart from Kx Systems.>> > > > 2) For my purpose, I would then have to extend this script so that I can> > > > keep my driver code constant. It would be great if there is a verbose> > > > description of s.k so that I can extend it.> > > You would have to know k4 and be familiar with this type of very tight> > > code. It would be a great intellectual exercise, but it is not easy.>> > > > 3) BTW, how do I debug??> > > Debug s.k (see previous point)? Or debug in general? :> > >http://kx.com/q/d/a/q.htm#Debug>> > > > The statements I would use are schema statements like described earlier,> > > > drop table, and simple table modifications using insert, update and> > delete.> > > > I am not able to quickly find how I can “drop” a table. This is for> > > > experimentation with SQL schemas.> > > If you will have to do a translation anyway I would convert them to q> > > - they should be trivial (in fact simpler)>> > > Regards,> > > Attila</attila.vrab…></yuvaraj…></attila.vrab…>
Maybedelete diff from select from(update diff:differ maxs score bydate,class from t)where diffis what you are looking for?Regards, AttilaOn Thu, May 15, 2008 at 4:17 PM, T10111 wrote:>> is it possible to combine recursion and grouping in a single query?> for example say there is a table, t, with fields> date,time,class,score.>> how would one construct a query such that it returns every new maximum> value in the score column grouped by date,class?>> i of course tried>> select date,time,class,score by date,class from t where (maxs> score)>prev maxs score, but the result was not what i was looking> for.>> i was able to get the correct answer by breaking the table into> smaller tables first (by date,class), and then applying a function> over the list smaller tables to handle the where clause part, but i> was hoping to find a better method.>>>> On May 11, 3:59 pm, “Attila Vrabecz” <attila.vrab…> wrote:>> apart from tables q also has atoms, vectors, lists, dictionaries, keyed tables>> to properly delete any variable from a namespace:>> delete variable from namespace>> the top-level namespace is ., so to delete a table from there>> delete table from
.>>>> Regards,>> Attila>>>> On Sun, May 11, 2008 at 3:09 AM, Yuvaraj Athur Raghuvir>>>> <yuvaraj…> wrote:>> > Thanks. I have started looking into using native q. Since I use an external>> > driver, I will have to do the translation externally. And thats ok for my>> > purposes.>>>> > One thing I have still not figured out - how to drop a table in q? My guess>> > is that any reassignment to the table name variable will cause the entire>> > table to get dropped. So, I could do:>> > q) EMP:([id:`int$()]name:`symbol$();empid:`long$()) \ will create the table>> > variable EMP>> > q) \ … do some table operations…>> > q)EMP:0 \drops the table!>>>> > Right?>>>> > As typical in any new language learning, I am trying to map the expressions>> > of the language I know (SQL) to the expressions of the language (q) I am>> > learning. So, there!>>>> > Regards,>> > Yuva>>>> > On Sun, May 11, 2008 at 2:37 AM, Attila Vrabecz <attila.vrab…>>> > wrote:>>>> > > > But now I see that I would need a translation between the SQL statements>> > I>> > > > have to the q statements because the support in s.k is minimal :(.>> > > I think its purpose is not too provide a full SQL implementation, but>> > > just to make interfacing for some clients a bit easier. Also (the code>> > > to implement the SQL subset)/(usefulness of the SQL subset) is still>> > > exceptionally. And in the end one should use q because it is much more>> > > powerful/simple/more fun (see examples at end of s.k for example).>>>> > > > 1) I saw once using .z.f that ..\s.k is loaded into the environment and>> > that>> > > > parses the SQL statements. But I am not able to see how that happened!!>> > And>> > > > I am still figuring out the execution mechanism behind this.>> > > One can implement own languages for kdb+ in k (or q) by putting them>> > > in x.k (where x is a letter, obviously k, q and s are already taken)>> > > in $QHOME and calling them later on by x)… Personally I never heard>> > > of anybody else who did this apart from Kx Systems.>>>> > > > 2) For my purpose, I would then have to extend this script so that I can>> > > > keep my driver code constant. It would be great if there is a verbose>> > > > description of s.k so that I can extend it.>> > > You would have to know k4 and be familiar with this type of very tight>> > > code. It would be a great intellectual exercise, but it is not easy.>>>> > > > 3) BTW, how do I debug??>> > > Debug s.k (see previous point)? Or debug in general? :>> > >http://kx.com/q/d/a/q.htm#Debug>>>> > > > The statements I would use are schema statements like described earlier,>> > > > drop table, and simple table modifications using insert, update and>> > delete.>> > > > I am not able to quickly find how I can “drop” a table. This is for>> > > > experimentation with SQL schemas.>> > > If you will have to do a translation anyway I would convert them to q>> > > - they should be trivial (in fact simpler)>>>> > > Regards,>> > > Attila> >></attila.vrab…></yuvaraj…></attila.vrab…>
isn’t this an fby problem?On Thu, May 15, 2008 at 1:39 PM, Attila Vrabecz<attila.vrabecz> wrote:>> Maybe>> delete diff from select from(update diff:differ maxs score by> date,class from t)where diff>> is what you are looking for?>> Regards,> Attila> On Thu, May 15, 2008 at 4:17 PM, T10111 wrote:>>>> is it possible to combine recursion and grouping in a single query?>> for example say there is a table, t, with fields>> date,time,class,score.>>>> how would one construct a query such that it returns every new maximum>> value in the score column grouped by date,class?>>>> i of course tried>>>> select date,time,class,score by date,class from t where (maxs>> score)>prev maxs score, but the result was not what i was looking>> for.>>>> i was able to get the correct answer by breaking the table into>> smaller tables first (by date,class), and then applying a function>> over the list smaller tables to handle the where clause part, but i>> was hoping to find a better method.>>>>>>>> On May 11, 3:59 pm, “Attila Vrabecz” <attila.vrab…> wrote:>>> apart from tables q also has atoms, vectors, lists, dictionaries, keyed tables>>> to properly delete any variable from a namespace:>>> delete variable from namespace>>> the top-level namespace is ., so to delete a table from there>>> delete table from
.>>>>>> Regards,>>> Attila>>>>>> On Sun, May 11, 2008 at 3:09 AM, Yuvaraj Athur Raghuvir>>>>>> <yuvaraj…> wrote:>>> > Thanks. I have started looking into using native q. Since I use an external>>> > driver, I will have to do the translation externally. And thats ok for my>>> > purposes.>>>>>> > One thing I have still not figured out - how to drop a table in q? My guess>>> > is that any reassignment to the table name variable will cause the entire>>> > table to get dropped. So, I could do:>>> > q) EMP:([id:`int$()]name:`symbol$();empid:`long$()) \ will create the table>>> > variable EMP>>> > q) \ … do some table operations…>>> > q)EMP:0 \drops the table!>>>>>> > Right?>>>>>> > As typical in any new language learning, I am trying to map the expressions>>> > of the language I know (SQL) to the expressions of the language (q) I am>>> > learning. So, there!>>>>>> > Regards,>>> > Yuva>>>>>> > On Sun, May 11, 2008 at 2:37 AM, Attila Vrabecz <attila.vrab…>>>> > wrote:>>>>>> > > > But now I see that I would need a translation between the SQL statements>>> > I>>> > > > have to the q statements because the support in s.k is minimal :(.>>> > > I think its purpose is not too provide a full SQL implementation, but>>> > > just to make interfacing for some clients a bit easier. Also (the code>>> > > to implement the SQL subset)/(usefulness of the SQL subset) is still>>> > > exceptionally. And in the end one should use q because it is much more>>> > > powerful/simple/more fun (see examples at end of s.k for example).>>>>>> > > > 1) I saw once using .z.f that ..\s.k is loaded into the environment and>>> > that>>> > > > parses the SQL statements. But I am not able to see how that happened!!>>> > And>>> > > > I am still figuring out the execution mechanism behind this.>>> > > One can implement own languages for kdb+ in k (or q) by putting them>>> > > in x.k (where x is a letter, obviously k, q and s are already taken)>>> > > in $QHOME and calling them later on by x)… Personally I never heard>>> > > of anybody else who did this apart from Kx Systems.>>>>>> > > > 2) For my purpose, I would then have to extend this script so that I can>>> > > > keep my driver code constant. It would be great if there is a verbose>>> > > > description of s.k so that I can extend it.>>> > > You would have to know k4 and be familiar with this type of very tight>>> > > code. It would be a great intellectual exercise, but it is not easy.>>>>>> > > > 3) BTW, how do I debug??>>> > > Debug s.k (see previous point)? Or debug in general? :>>> > >http://kx.com/q/d/a/q.htm#Debug>>>>>> > > > The statements I would use are schema statements like described earlier,>>> > > > drop table, and simple table modifications using insert, update and>>> > delete.>>> > > > I am not able to quickly find how I can “drop” a table. This is for>>> > > > experimentation with SQL schemas.>>> > > If you will have to do a translation anyway I would convert them to q>>> > > - they should be trivial (in fact simpler)>>>>>> > > Regards,>>> > > Attila>> >>>>> >>– Aaron Daviesaaron.davies@gmail.com</attila.vrab…></yuvaraj…></attila.vrab…></attila.vrabecz>
i think not, because maxs is not an aggregation, it is a uniform functionbut feel free to provide an fby solution AttilaOn Thu, May 15, 2008 at 9:43 PM, Aaron Davies <aaron.davies> wrote:>> isn’t this an fby problem?>> On Thu, May 15, 2008 at 1:39 PM, Attila Vrabecz> <attila.vrabecz> wrote:>>>> Maybe>>>> delete diff from select from(update diff:differ maxs score by>> date,class from t)where diff>>>> is what you are looking for?>>>> Regards,>> Attila>> On Thu, May 15, 2008 at 4:17 PM, T10111 wrote:>>>>>> is it possible to combine recursion and grouping in a single query?>>> for example say there is a table, t, with fields>>> date,time,class,score.>>>>>> how would one construct a query such that it returns every new maximum>>> value in the score column grouped by date,class?>>>>>> i of course tried>>>>>> select date,time,class,score by date,class from t where (maxs>>> score)>prev maxs score, but the result was not what i was looking>>> for.>>>>>> i was able to get the correct answer by breaking the table into>>> smaller tables first (by date,class), and then applying a function>>> over the list smaller tables to handle the where clause part, but i>>> was hoping to find a better method.>>>>>>>>>>>> On May 11, 3:59 pm, “Attila Vrabecz” <attila.vrab…> wrote:>>>> apart from tables q also has atoms, vectors, lists, dictionaries, keyed tables>>>> to properly delete any variable from a namespace:>>>> delete variable from namespace>>>> the top-level namespace is ., so to delete a table from there>>>> delete table from
.>>>>>>>> Regards,>>>> Attila>>>>>>>> On Sun, May 11, 2008 at 3:09 AM, Yuvaraj Athur Raghuvir>>>>>>>> <yuvaraj…> wrote:>>>> > Thanks. I have started looking into using native q. Since I use an external>>>> > driver, I will have to do the translation externally. And thats ok for my>>>> > purposes.>>>>>>>> > One thing I have still not figured out - how to drop a table in q? My guess>>>> > is that any reassignment to the table name variable will cause the entire>>>> > table to get dropped. So, I could do:>>>> > q) EMP:([id:`int$()]name:`symbol$();empid:`long$()) \ will create the table>>>> > variable EMP>>>> > q) \ … do some table operations…>>>> > q)EMP:0 \drops the table!>>>>>>>> > Right?>>>>>>>> > As typical in any new language learning, I am trying to map the expressions>>>> > of the language I know (SQL) to the expressions of the language (q) I am>>>> > learning. So, there!>>>>>>>> > Regards,>>>> > Yuva>>>>>>>> > On Sun, May 11, 2008 at 2:37 AM, Attila Vrabecz <attila.vrab…>>>>> > wrote:>>>>>>>> > > > But now I see that I would need a translation between the SQL statements>>>> > I>>>> > > > have to the q statements because the support in s.k is minimal :(.>>>> > > I think its purpose is not too provide a full SQL implementation, but>>>> > > just to make interfacing for some clients a bit easier. Also (the code>>>> > > to implement the SQL subset)/(usefulness of the SQL subset) is still>>>> > > exceptionally. And in the end one should use q because it is much more>>>> > > powerful/simple/more fun (see examples at end of s.k for example).>>>>>>>> > > > 1) I saw once using .z.f that ..\s.k is loaded into the environment and>>>> > that>>>> > > > parses the SQL statements. But I am not able to see how that happened!!>>>> > And>>>> > > > I am still figuring out the execution mechanism behind this.>>>> > > One can implement own languages for kdb+ in k (or q) by putting them>>>> > > in x.k (where x is a letter, obviously k, q and s are already taken)>>>> > > in $QHOME and calling them later on by x)… Personally I never heard>>>> > > of anybody else who did this apart from Kx Systems.>>>>>>>> > > > 2) For my purpose, I would then have to extend this script so that I can>>>> > > > keep my driver code constant. It would be great if there is a verbose>>>> > > > description of s.k so that I can extend it.>>>> > > You would have to know k4 and be familiar with this type of very tight>>>> > > code. It would be a great intellectual exercise, but it is not easy.>>>>>>>> > > > 3) BTW, how do I debug??>>>> > > Debug s.k (see previous point)? Or debug in general? :>>>> > >http://kx.com/q/d/a/q.htm#Debug>>>>>>>> > > > The statements I would use are schema statements like described earlier,>>>> > > > drop table, and simple table modifications using insert, update and>>>> > delete.>>>> > > > I am not able to quickly find how I can “drop” a table. This is for>>>> > > > experimentation with SQL schemas.>>>> > > If you will have to do a translation anyway I would convert them to q>>>> > > - they should be trivial (in fact simpler)>>>>>>>> > > Regards,>>>> > > Attila>>> >>>>>>>> >>>>>>> –> Aaron Davies> aaron.davies@gmail.com>> >></attila.vrab…></yuvaraj…></attila.vrab…></attila.vrabecz></aaron.davies>
Attila, Thanks for the reply. I am receiving the 'par error whenexecuting the suggested command. I could not find any info on thiserror on code.kx.com, what does it indicate?On May 16, 2:51 am, “Attila Vrabecz” <attila.vrab…> wrote:> i think not, because maxs is not an aggregation, it is a uniform function> but feel free to provide an fby solution>> Attila>> On Thu, May 15, 2008 at 9:43 PM, Aaron Davies <aaron.dav…> wrote:>> > isn’t this an fby problem?>> > On Thu, May 15, 2008 at 1:39 PM, Attila Vrabecz> > <attila.vrab…> wrote:>> >> Maybe>> >> delete diff from select from(update diff:differ maxs score by> >> date,class from t)where diff>> >> is what you are looking for?>> >> Regards,> >> Attila> >> On Thu, May 15, 2008 at 4:17 PM, T10111 <tribalis…> wrote:>> >>> is it possible to combine recursion and grouping in a single query?> >>> for example say there is a table, t, with fields> >>> date,time,class,score.>> >>> how would one construct a query such that it returns every new maximum> >>> value in the score column grouped by date,class?>> >>> i of course tried>> >>> select date,time,class,score by date,class from t where (maxs> >>> score)>prev maxs score, but the result was not what i was looking> >>> for.>> >>> i was able to get the correct answer by breaking the table into> >>> smaller tables first (by date,class), and then applying a function> >>> over the list smaller tables to handle the where clause part, but i> >>> was hoping to find a better method.>> >>> On May 11, 3:59 pm, “Attila Vrabecz” <attila.vrab…> wrote:> >>>> apart from tables q also has atoms, vectors, lists, dictionaries, keyed tables> >>>> to properly delete any variable from a namespace:> >>>> delete variable from namespace> >>>> the top-level namespace is ., so to delete a table from there> >>>> delete table from
.>> >>>> Regards,> >>>> Attila>> >>>> On Sun, May 11, 2008 at 3:09 AM, Yuvaraj Athur Raghuvir>> >>>> <yuvaraj…> wrote:> >>>> > Thanks. I have started looking into using native q. Since I use an external> >>>> > driver, I will have to do the translation externally. And thats ok for my> >>>> > purposes.>> >>>> > One thing I have still not figured out - how to drop a table in q? My guess> >>>> > is that any reassignment to the table name variable will cause the entire> >>>> > table to get dropped. So, I could do:> >>>> > q) EMP:([id:`int$()]name:`symbol$();empid:`long$()) \ will create the table> >>>> > variable EMP> >>>> > q) \ … do some table operations…> >>>> > q)EMP:0 \drops the table!>> >>>> > Right?>> >>>> > As typical in any new language learning, I am trying to map the expressions> >>>> > of the language I know (SQL) to the expressions of the language (q) I am> >>>> > learning. So, there!>> >>>> > Regards,> >>>> > Yuva>> >>>> > On Sun, May 11, 2008 at 2:37 AM, Attila Vrabecz <attila.vrab…>> >>>> > wrote:>> >>>> > > > But now I see that I would need a translation between the SQL statements> >>>> > I> >>>> > > > have to the q statements because the support in s.k is minimal :(.> >>>> > > I think its purpose is not too provide a full SQL implementation, but> >>>> > > just to make interfacing for some clients a bit easier. Also (the code> >>>> > > to implement the SQL subset)/(usefulness of the SQL subset) is still> >>>> > > exceptionally. And in the end one should use q because it is much more> >>>> > > powerful/simple/more fun (see examples at end of s.k for example).>> >>>> > > > 1) I saw once using .z.f that ..\s.k is loaded into the environment and> >>>> > that> >>>> > > > parses the SQL statements. But I am not able to see how that happened!!> >>>> > And> >>>> > > > I am still figuring out the execution mechanism behind this.> >>>> > > One can implement own languages for kdb+ in k (or q) by putting them> >>>> > > in x.k (where x is a letter, obviously k, q and s are already taken)> >>>> > > in $QHOME and calling them later on by x)… Personally I never heard> >>>> > > of anybody else who did this apart from Kx Systems.>> >>>> > > > 2) For my purpose, I would then have to extend this script so that I can> >>>> > > > keep my driver code constant. It would be great if there is a verbose> >>>> > > > description of s.k so that I can extend it.> >>>> > > You would have to know k4 and be familiar with this type of very tight> >>>> > > code. It would be a great intellectual exercise, but it is not easy.>> >>>> > > > 3) BTW, how do I debug??> >>>> > > Debug s.k (see previous point)? Or debug in general? :> >>>> > >http://kx.com/q/d/a/q.htm#Debug>> >>>> > > > The statements I would use are schema statements like described earlier,> >>>> > > > drop table, and simple table modifications using insert, update and> >>>> > delete.> >>>> > > > I am not able to quickly find how I can “drop” a table. This is for> >>>> > > > experimentation with SQL schemas.> >>>> > > If you will have to do a translation anyway I would convert them to q> >>>> > > - they should be trivial (in fact simpler)>> >>>> > > Regards,> >>>> > > Attila>> > –> > Aaron Davies> > aaron.dav...@gmail.com</attila.vrab…></yuvaraj…></attila.vrab…></tribalis…></attila.vrab…></aaron.dav…></attila.vrab…>
perhaps i’m not clear on the problemT10111 (or attila), do you have some sample data (and output)?On Fri, May 16, 2008 at 2:51 AM, Attila Vrabecz<attila.vrabecz> wrote:>> i think not, because maxs is not an aggregation, it is a uniform function> but feel free to provide an fby solution>> Attila>> On Thu, May 15, 2008 at 9:43 PM, Aaron Davies <aaron.davies> wrote:>>>> isn’t this an fby problem?>>>> On Thu, May 15, 2008 at 1:39 PM, Attila Vrabecz>> <attila.vrabecz> wrote:>>>>>> Maybe>>>>>> delete diff from select from(update diff:differ maxs score by>>> date,class from t)where diff>>>>>> is what you are looking for?>>>>>> Regards,>>> Attila>>> On Thu, May 15, 2008 at 4:17 PM, T10111 wrote:>>>>>>>> is it possible to combine recursion and grouping in a single query?>>>> for example say there is a table, t, with fields>>>> date,time,class,score.>>>>>>>> how would one construct a query such that it returns every new maximum>>>> value in the score column grouped by date,class?>>>>>>>> i of course tried>>>>>>>> select date,time,class,score by date,class from t where (maxs>>>> score)>prev maxs score, but the result was not what i was looking>>>> for.>>>>>>>> i was able to get the correct answer by breaking the table into>>>> smaller tables first (by date,class), and then applying a function>>>> over the list smaller tables to handle the where clause part, but i>>>> was hoping to find a better method.>>>>>>>>>>>>>>>> On May 11, 3:59 pm, “Attila Vrabecz” <attila.vrab…> wrote:>>>>> apart from tables q also has atoms, vectors, lists, dictionaries, keyed tables>>>>> to properly delete any variable from a namespace:>>>>> delete variable from namespace>>>>> the top-level namespace is ., so to delete a table from there>>>>> delete table from
.>>>>>>>>>> Regards,>>>>> Attila>>>>>>>>>> On Sun, May 11, 2008 at 3:09 AM, Yuvaraj Athur Raghuvir>>>>>>>>>> <yuvaraj…> wrote:>>>>> > Thanks. I have started looking into using native q. Since I use an external>>>>> > driver, I will have to do the translation externally. And thats ok for my>>>>> > purposes.>>>>>>>>>> > One thing I have still not figured out - how to drop a table in q? My guess>>>>> > is that any reassignment to the table name variable will cause the entire>>>>> > table to get dropped. So, I could do:>>>>> > q) EMP:([id:`int$()]name:`symbol$();empid:`long$()) \ will create the table>>>>> > variable EMP>>>>> > q) \ … do some table operations…>>>>> > q)EMP:0 \drops the table!>>>>>>>>>> > Right?>>>>>>>>>> > As typical in any new language learning, I am trying to map the expressions>>>>> > of the language I know (SQL) to the expressions of the language (q) I am>>>>> > learning. So, there!>>>>>>>>>> > Regards,>>>>> > Yuva>>>>>>>>>> > On Sun, May 11, 2008 at 2:37 AM, Attila Vrabecz <attila.vrab…>>>>>> > wrote:>>>>>>>>>> > > > But now I see that I would need a translation between the SQL statements>>>>> > I>>>>> > > > have to the q statements because the support in s.k is minimal :(.>>>>> > > I think its purpose is not too provide a full SQL implementation, but>>>>> > > just to make interfacing for some clients a bit easier. Also (the code>>>>> > > to implement the SQL subset)/(usefulness of the SQL subset) is still>>>>> > > exceptionally. And in the end one should use q because it is much more>>>>> > > powerful/simple/more fun (see examples at end of s.k for example).>>>>>>>>>> > > > 1) I saw once using .z.f that ..\s.k is loaded into the environment and>>>>> > that>>>>> > > > parses the SQL statements. But I am not able to see how that happened!!>>>>> > And>>>>> > > > I am still figuring out the execution mechanism behind this.>>>>> > > One can implement own languages for kdb+ in k (or q) by putting them>>>>> > > in x.k (where x is a letter, obviously k, q and s are already taken)>>>>> > > in $QHOME and calling them later on by x)… Personally I never heard>>>>> > > of anybody else who did this apart from Kx Systems.>>>>>>>>>> > > > 2) For my purpose, I would then have to extend this script so that I can>>>>> > > > keep my driver code constant. It would be great if there is a verbose>>>>> > > > description of s.k so that I can extend it.>>>>> > > You would have to know k4 and be familiar with this type of very tight>>>>> > > code. It would be a great intellectual exercise, but it is not easy.>>>>>>>>>> > > > 3) BTW, how do I debug??>>>>> > > Debug s.k (see previous point)? Or debug in general? :>>>>> > >http://kx.com/q/d/a/q.htm#Debug>>>>>>>>>> > > > The statements I would use are schema statements like described earlier,>>>>> > > > drop table, and simple table modifications using insert, update and>>>>> > delete.>>>>> > > > I am not able to quickly find how I can “drop” a table. This is for>>>>> > > > experimentation with SQL schemas.>>>>> > > If you will have to do a translation anyway I would convert them to q>>>>> > > - they should be trivial (in fact simpler)>>>>>>>>>> > > Regards,>>>>> > > Attila>>>> >>>>>>>>>>> >>>>>>>>>>>> –>> Aaron Davies>> aaron.davies@gmail.com>>>> >>>>> >>– Aaron Daviesaaron.davies@gmail.com</attila.vrab…></yuvaraj…></attila.vrab…></attila.vrabecz></aaron.davies></attila.vrabecz>
Aaron, below is a simple example of what I am looking to return.Given the table:Date Class Score2008-01-01 ABC 0.942008-01-01 XYZ 912008-01-01 ABC 0.962008-01-01 XYZ 892008-01-01 ABC 0.962008-01-01 XYZ 932008-02-01 ABC 0.92008-02-01 XYZ 962008-02-01 ABC 0.922008-02-01 XYZ 952008-02-01 ABC 0.942008-02-01 XYZ 94I would like to returnDate Class Score2008-01-01 ABC 0.942008-01-01 ABC 0.962008-01-01 XYZ 912008-01-01 XYZ 932008-02-01 ABC 0.92008-02-01 ABC 0.922008-02-01 ABC 0.942008-02-01 XYZ 96Thanks.On May 16, 10:23 am, “Aaron Davies” <aaron.dav…> wrote:> perhaps i’m not clear on the problem>> T10111 (or attila), do you have some sample data (and output)?>> On Fri, May 16, 2008 at 2:51 AM, Attila Vrabecz>>>> <attila.vrab…> wrote:>> > i think not, because maxs is not an aggregation, it is a uniform function> > but feel free to provide an fby solution>> > Attila>> > On Thu, May 15, 2008 at 9:43 PM, Aaron Davies <aaron.dav…> wrote:>> >> isn’t this an fby problem?>> >> On Thu, May 15, 2008 at 1:39 PM, Attila Vrabecz> >> <attila.vrab…> wrote:>> >>> Maybe>> >>> delete diff from select from(update diff:differ maxs score by> >>> date,class from t)where diff>> >>> is what you are looking for?>> >>> Regards,> >>> Attila> >>> On Thu, May 15, 2008 at 4:17 PM, T10111 <tribalis…> wrote:>> >>>> is it possible to combine recursion and grouping in a single query?> >>>> for example say there is a table, t, with fields> >>>> date,time,class,score.>> >>>> how would one construct a query such that it returns every new maximum> >>>> value in the score column grouped by date,class?>> >>>> i of course tried>> >>>> select date,time,class,score by date,class from t where (maxs> >>>> score)>prev maxs score, but the result was not what i was looking> >>>> for.>> >>>> i was able to get the correct answer by breaking the table into> >>>> smaller tables first (by date,class), and then applying a function> >>>> over the list smaller tables to handle the where clause part, but i> >>>> was hoping to find a better method.>> >>>> On May 11, 3:59 pm, “Attila Vrabecz” <attila.vrab…> wrote:> >>>>> apart from tables q also has atoms, vectors, lists, dictionaries, keyed tables> >>>>> to properly delete any variable from a namespace:> >>>>> delete variable from namespace> >>>>> the top-level namespace is ., so to delete a table from there> >>>>> delete table from
.>> >>>>> Regards,> >>>>> Attila>> >>>>> On Sun, May 11, 2008 at 3:09 AM, Yuvaraj Athur Raghuvir>> >>>>> <yuvaraj…> wrote:> >>>>> > Thanks. I have started looking into using native q. Since I use an external> >>>>> > driver, I will have to do the translation externally. And thats ok for my> >>>>> > purposes.>> >>>>> > One thing I have still not figured out - how to drop a table in q? My guess> >>>>> > is that any reassignment to the table name variable will cause the entire> >>>>> > table to get dropped. So, I could do:> >>>>> > q) EMP:([id:`int$()]name:`symbol$();empid:`long$()) \ will create the table> >>>>> > variable EMP> >>>>> > q) \ … do some table operations…> >>>>> > q)EMP:0 \drops the table!>> >>>>> > Right?>> >>>>> > As typical in any new language learning, I am trying to map the expressions> >>>>> > of the language I know (SQL) to the expressions of the language (q) I am> >>>>> > learning. So, there!>> >>>>> > Regards,> >>>>> > Yuva>> >>>>> > On Sun, May 11, 2008 at 2:37 AM, Attila Vrabecz <attila.vrab…>> >>>>> > wrote:>> >>>>> > > > But now I see that I would need a translation between the SQL statements> >>>>> > I> >>>>> > > > have to the q statements because the support in s.k is minimal :(.> >>>>> > > I think its purpose is not too provide a full SQL implementation, but> >>>>> > > just to make interfacing for some clients a bit easier. Also (the code> >>>>> > > to implement the SQL subset)/(usefulness of the SQL subset) is still> >>>>> > > exceptionally. And in the end one should use q because it is much more> >>>>> > > powerful/simple/more fun (see examples at end of s.k for example).>> >>>>> > > > 1) I saw once using .z.f that ..\s.k is loaded into the environment and> >>>>> > that> >>>>> > > > parses the SQL statements. But I am not able to see how that happened!!> >>>>> > And> >>>>> > > > I am still figuring out the execution mechanism behind this.> >>>>> > > One can implement own languages for kdb+ in k (or q) by putting them> >>>>> > > in x.k (where x is a letter, obviously k, q and s are already taken)> >>>>> > > in $QHOME and calling them later on by x)… Personally I never heard> >>>>> > > of anybody else who did this apart from Kx Systems.>> >>>>> > > > 2) For my purpose, I would then have to extend this script so that I can> >>>>> > > > keep my driver code constant. It would be great if there is a verbose> >>>>> > > > description of s.k so that I can extend it.> >>>>> > > You would have to know k4 and be familiar with this type of very tight> >>>>> > > code. It would be a great intellectual exercise, but it is not easy.>> >>>>> > > > 3) BTW, how do I debug??> >>>>> > > Debug s.k (see previous point)? Or debug in general? :> >>>>> > >http://kx.com/q/d/a/q.htm#Debug>> >>>>> > > > The statements I would use are schema statements like described earlier,> >>>>> > > > drop table, and simple table modifications using insert, update and> >>>>> > delete.> >>>>> > > > I am not able to quickly find how I can “drop” a table. This is for> >>>>> > > > experimentation with SQL schemas.> >>>>> > > If you will have to do a translation anyway I would convert them to q> >>>>> > > - they should be trivial (in fact simpler)>> >>>>> > > Regards,> >>>>> > > Attila>> >> –> >> Aaron Davies> >> aaron.dav...@gmail.com>> –> Aaron Davies> aaron.dav...@gmail.com</attila.vrab…></yuvaraj…></attila.vrab…></tribalis…></attila.vrab…></aaron.dav…></attila.vrab…></aaron.dav…>
<1855e77f0805101407w6b23186ftd3b31d97f7d82273@mail.gmail.com>
<10505d5c0805101909y6597d710sb5e1563d1cb41a6c@mail.gmail.com>
<1855e77f0805111259s7630bfe9iefd13e400062f83e@mail.gmail.com>
<0d1f229e-c4de-410b-96c4-a3f732e7dd47@a23g2000hsc.googlegroups.com>
<1855e77f0805151039l3f28fe57p4df7fdd9231f2cd2@mail.gmail.com>
<1855e77f0805152351r7225c0b8xc21c126252cb6578@mail.gmail.com>
<08ae0575-e373-4ccf-9575-2a4bfb6253a4@59g2000hsb.googlegroups.com>
My guess is that you would like to run this query on a partitioned
table, is that true?
Because it will only work on in-memory tables. You have to select just
the subset of columns and rows you need into t
tmem:select col1,col2,… from t where date=…,…
But I think it does what you asked for.
q)Date
Class xasc delete diff from select from(update diff:differ
maxs Score by Date,Class from t) where diff
Date Class Score
----------------------
2008.01.01 ABC 0.94
2008.01.01 ABC 0.96
2008.01.01 XYZ 91
2008.01.01 XYZ 93
2008.02.01 ABC 0.9
2008.02.01 ABC 0.92
2008.02.01 ABC 0.94
2008.02.01 XYZ 96
Regards,
Attila
On Fri, May 16, 2008 at 6:30 PM, T10111 wrote:
>
> Aaron, below is a simple example of what I am looking to return.
>
> Given the table:
>
> Date Class Score
> 2008-01-01 ABC 0.94
> 2008-01-01 XYZ 91
> 2008-01-01 ABC 0.96
> 2008-01-01 XYZ 89
> 2008-01-01 ABC 0.96
> 2008-01-01 XYZ 93
> 2008-02-01 ABC 0.9
> 2008-02-01 XYZ 96
> 2008-02-01 ABC 0.92
> 2008-02-01 XYZ 95
> 2008-02-01 ABC 0.94
> 2008-02-01 XYZ 94
>
> I would like to return
>
> Date Class Score
> 2008-01-01 ABC 0.94
> 2008-01-01 ABC 0.96
> 2008-01-01 XYZ 91
> 2008-01-01 XYZ 93
> 2008-02-01 ABC 0.9
> 2008-02-01 ABC 0.92
> 2008-02-01 ABC 0.94
> 2008-02-01 XYZ 96
>
> Thanks.
>
>
>
> On May 16, 10:23 am, “Aaron Davies” <aaron.dav…> wrote:
>> perhaps i’m not clear on the problem
>>
>> T10111 (or attila), do you have some sample data (and output)?
>>
>> On Fri, May 16, 2008 at 2:51 AM, Attila Vrabecz
>>
>>
>>
>> <attila.vrab…> wrote:
>>
>> > i think not, because maxs is not an aggregation, it is a uniform function
>> > but feel free to provide an fby solution
>>
>> > Attila
>>
>> > On Thu, May 15, 2008 at 9:43 PM, Aaron Davies <aaron.dav…> wrote:
>>
>> >> isn’t this an fby problem?
>>
>> >> On Thu, May 15, 2008 at 1:39 PM, Attila Vrabecz
>> >> <attila.vrab…> wrote:
>>
>> >>> Maybe
>>
>> >>> delete diff from select from(update diff:differ maxs score by
>> >>> date,class from t)where diff
>>
>> >>> is what you are looking for?
>>
>> >>> Regards,
>> >>> Attila
>> >>> On Thu, May 15, 2008 at 4:17 PM, T10111 <tribalis…> wrote:
>>
>> >>>> is it possible to combine recursion and grouping in a single query?
>> >>>> for example say there is a table, t, with fields
>> >>>> date,time,class,score.
>>
>> >>>> how would one construct a query such that it returns every new maximum
>> >>>> value in the score column grouped by date,class?
>>
>> >>>> i of course tried
>>
>> >>>> select date,time,class,score by date,class from t where (maxs
>> >>>> score)>prev maxs score, but the result was not what i was looking
>> >>>> for.
>>
>> >>>> i was able to get the correct answer by breaking the table into
>> >>>> smaller tables first (by date,class), and then applying a function
>> >>>> over the list smaller tables to handle the where clause part, but i
>> >>>> was hoping to find a better method.
>>
>> >>>> On May 11, 3:59 pm, “Attila Vrabecz” <attila.vrab…> wrote:
>> >>>>> apart from tables q also has atoms, vectors, lists, dictionaries, keyed tables
>> >>>>> to properly delete any variable from a namespace:
>> >>>>> delete variable from namespace
>> >>>>> the top-level namespace is ., so to delete a table from there<br>>> >>>>> delete table from
.
>>
>> >>>>> Regards,
>> >>>>> Attila
>>
>> >>>>> On Sun, May 11, 2008 at 3:09 AM, Yuvaraj Athur Raghuvir
>>
>> >>>>> <yuvaraj…> wrote:
>> >>>>> > Thanks. I have started looking into using native q. Since I use an external
>> >>>>> > driver, I will have to do the translation externally. And thats ok for my
>> >>>>> > purposes.
>>
>> >>>>> > One thing I have still not figured out - how to drop a table in q? My guess
>> >>>>> > is that any reassignment to the table name variable will cause the entire
>> >>>>> > table to get dropped. So, I could do:
>> >>>>> > q) EMP:([id:`int$()]name:`symbol$();empid:`long$()) \ will create the table
>> >>>>> > variable EMP
>> >>>>> > q) \ … do some table operations…
>> >>>>> > q)EMP:0 \drops the table!
>>
>> >>>>> > Right?
>>
>> >>>>> > As typical in any new language learning, I am trying to map the expressions
>> >>>>> > of the language I know (SQL) to the expressions of the language (q) I am
>> >>>>> > learning. So, there!
>>
>> >>>>> > Regards,
>> >>>>> > Yuva
>>
>> >>>>> > On Sun, May 11, 2008 at 2:37 AM, Attila Vrabecz <attila.vrab…>
>> >>>>> > wrote:
>>
>> >>>>> > > > But now I see that I would need a translation between the SQL statements
>> >>>>> > I
>> >>>>> > > > have to the q statements because the support in s.k is minimal :(.
>> >>>>> > > I think its purpose is not too provide a full SQL implementation, but
>> >>>>> > > just to make interfacing for some clients a bit easier. Also (the code
>> >>>>> > > to implement the SQL subset)/(usefulness of the SQL subset) is still
>> >>>>> > > exceptionally. And in the end one should use q because it is much more
>> >>>>> > > powerful/simple/more fun (see examples at end of s.k for example).
>>
>> >>>>> > > > 1) I saw once using .z.f that ..\s.k is loaded into the environment and
>> >>>>> > that
>> >>>>> > > > parses the SQL statements. But I am not able to see how that happened!!
>> >>>>> > And
>> >>>>> > > > I am still figuring out the execution mechanism behind this.
>> >>>>> > > One can implement own languages for kdb+ in k (or q) by putting them
>> >>>>> > > in x.k (where x is a letter, obviously k, q and s are already taken)
>> >>>>> > > in $QHOME and calling them later on by x)… Personally I never heard
>> >>>>> > > of anybody else who did this apart from Kx Systems.
>>
>> >>>>> > > > 2) For my purpose, I would then have to extend this script so that I can
>> >>>>> > > > keep my driver code constant. It would be great if there is a verbose
>> >>>>> > > > description of s.k so that I can extend it.
>> >>>>> > > You would have to know k4 and be familiar with this type of very tight
>> >>>>> > > code. It would be a great intellectual exercise, but it is not easy.
>>
>> >>>>> > > > 3) BTW, how do I debug??
>> >>>>> > > Debug s.k (see previous point)? Or debug in general? :
>> >>>>> > >http://kx.com/q/d/a/q.htm#Debug
>>
>> >>>>> > > > The statements I would use are schema statements like described earlier,
>> >>>>> > > > drop table, and simple table modifications using insert, update and
>> >>>>> > delete.
>> >>>>> > > > I am not able to quickly find how I can “drop” a table. This is for
>> >>>>> > > > experimentation with SQL schemas.
>> >>>>> > > If you will have to do a translation anyway I would convert them to q
>> >>>>> > > - they should be trivial (in fact simpler)
>>
>> >>>>> > > Regards,
>> >>>>> > > Attila
>>
>> >> –
>> >> Aaron Davies
>> >> aaron.dav...@gmail.com
>>
>> –
>> Aaron Davies
>> aaron.dav...@gmail.com
> >
>
</attila.vrab…></yuvaraj…></attila.vrab…></tribalis…></attila.vrab…></aaron.dav…></attila.vrab…></aaron.dav…>