Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

KDB Query for OR operator

Tags:

kdb

What is the equivalent query in KDB Web:

SELECT * FROM TABLE
WHERE (COLA = 'A' AND COLB = 'B') OR (COLA = 'C' AND COLB = 'D')

http://kdbserver:5001/?select fro table where _____________________

N.B.: cola and colb are having string datatype

like image 870
Debananda Avatar asked Nov 07 '14 14:11

Debananda


People also ask

What is the use of KDB?

kdb+ is a column-based relational time series database (TSDB) with in-memory (IMDB) abilities, developed and marketed by Kx Systems. The database is commonly used in high-frequency trading (HFT) to store, analyze, process, and retrieve large data sets at high speed.

What is Q and kdb+?

Kdb+ is a powerful database that can be used for streaming, real-time and historical data. Q is the SQL-like, general-purpose programming language built on top of kdb+. It offers high-performance, in-database analytic capabilities. Get started to download and install kdb+.

What is KDB programming language?

Kdb+ is an in-memory, column-based database with much of the same functions of a relational database management system. The database supports SQL, SQL-92 and ksql, a query language with a syntax similar to SQL and designed for column based queries and array analysis.

What is a vector in KDB?

A vector is a list of atoms of the same type. Some examples: 2 3 4 5 / int "A fine, clear day" / char `ibm`goog`aapl`ibm`msft / symbol 2017.01 2017.02 2017.03m / month. Kdb+ stores and handles vectors very efficiently. Q operators – not just +-*% but e.g. mcount , ratios , prds – are optimised for vectors.


2 Answers

You can do:

select from table where ((COLA like "string1")&(COLB like "string2"))|((COLA like "string3")&(COLB like "string4"))
like image 53
WooiKent Lee Avatar answered Sep 20 '22 23:09

WooiKent Lee


select from table where ([]colA;colB) in ([]colA:`A`C;colB:`B`D)
like image 22
Connor Gervin Avatar answered Sep 16 '22 23:09

Connor Gervin