Introduction to SQL in KDB-X

This page introduces SQL support in KDB-X, outlining how the interface translates SQL statements into q expressions at runtime.

SQL provides a familiar relational interface for querying and managing data in KDB-X, allowing users to leverage standard SQL syntax within the q environment.

Note

SQL is currently offered as part of core but may be embedded as a module in the future.

Concepts

SQL in KDB-X combines ANSI SQL familiarity with the power of the q interface.

  • Translation layer: The interface translates SQL statements into q expressions at runtime.

  • ANSI SQL alignment: SQL in KDB-X implements a subset of ANSI SQL features.

  • Data integration: You can run SQL and q queries on the same data in the same session.

Use cases

SQL in KDB-X helps different users work with data efficiently.

  • Query relational-style data in KDB-X with SQL.

  • Onboard SQL developers quickly without requiring q knowledge.

  • Prototype queries in SQL before rewriting or optimizing them in q.

Architecture

The SQL interface in KDB-X parses, translates, and executes SQL statements against q data.

  • The SQL parser reads and interprets SQL commands.

  • The interface converts SQL into q at runtime.

  • The system raises errors when you use unsupported syntax.

SQL language support

SQL in KDB-X supports a wide range of common SQL features:

Next steps

Check out the following guides for more details on how to get started with SQL: