Search code examples
kdb

Querying a table using KDB


How can i query a table using kdb I created a table using the code following

q)name:`Iain`Nathan`Ryan`Ross
q)number:98 42 126 98 
q)table:([] name; number)

This creates a table:

name          number
Iain          98 
Nathan        42
Ryan          126
Ross          98 

How can a query this table to return results of number which is equal to "98" Or name which is equal to Iain

This is what I had been using


Solution

  • You can do this using a Q-SQL statement

    select from table where number=98

    The documentation for these this form of querying can be found at https://code.kx.com/q/ref/qsql/