k1:([a:("ff"; "yy"; "zz");z:("tt"; "yy"; "hh")] b:("33"; "44"; "55"); c:("66"; "77"; "88"))
k2:([z:()] a:(); b:(); c:(); m:(); i:())
Run Code Online (Sandbox Code Playgroud)
k1并且k2是键控表.k2拥有所有列k1和更多.
如何从执行条件UPSERT k1来k2.基本上,下面的相应工作说明是什么:
`k2 upsert select k1 where a="ff"
Run Code Online (Sandbox Code Playgroud) 我有一张桌子bb:
bb:([]key1: 0 1 2 1 7; col1: 1 2 3 4 5; col2: 5 4 3 2 1; col3:("11";"22" ;"33" ;"44"; "55"))
Run Code Online (Sandbox Code Playgroud)
如何对字符串进行关系比较?假设我想获得col3小于或等于"33"的记录
select from bb where col3 <= "33"
Run Code Online (Sandbox Code Playgroud)
预期结果:
key1 col1 col2 col3
0 1 5 11
1 2 4 22
2 3 3 33
Run Code Online (Sandbox Code Playgroud) q)t:flip `name`iq!(`Dent``Prefect;98 32 34)
q)t
name iq
----------
Dent 98
32
Prefect 34
Run Code Online (Sandbox Code Playgroud)
如何形成条件查询以对列进行操作 name
q)select case when name is null then `Empty else name ,iq from t
Run Code Online (Sandbox Code Playgroud)
预期产量:
name iq
----------
name iq
Dent 98
Empty 32
Prefect 34
Run Code Online (Sandbox Code Playgroud) 我有下表t:
t:([]sym:3#`ibm;time:10:01:01 10:01:04 10:01:08;price:100 101 105;val:("hello";"world";"test"))
Run Code Online (Sandbox Code Playgroud)
如何执行以下查询:
select from t where val in ("hello"; "test")
Run Code Online (Sandbox Code Playgroud)
其中我期待以下结果:
sym time price val
---------------------------
ibm 10:01:01 100 hello
ibm 10:01:08 105 test
Run Code Online (Sandbox Code Playgroud) kdb ×4