Hacker News new | ask | show | jobs
by thestgman1 674 days ago
KDB is an absolute nightmare, a barbaric piece of tech that should have never existed.

Here is a link on how you do queries: https://code.kx.com/q/basics/funsql/

TL;DR;

This is a select: q)t:([] c1:`a`b`a`c`a`b`c; c2:101+til 7; c3:1.11+til 7)

And this is another select: q)?[t; ((>;`c2;35);(in;`c1;enlist[`b`c])); 0b; ()]

Mind that these are the basic queries :)))))

The future of kdb+ is in the toilet.

1 comments

The first one is not a select but syntax for defining a small in-memory table named t. You can then do a select on this table. The second is a "functional form" of select i.e. an alternative syntax for select with extended capabilities. It is an advanced feature that is rarely used, but it's there when you need it "for programmatically-generated queries, such as when column names are dynamically produced". Written in the usual syntax this particular expression is the same as "select from t where c2>35,c1 in `b`c".