SELECT

SELECT

Selects rows from a KSQL stream or table. The result of this statement is not persisted in a topic and is only printed out in the console. To stop the continuous query in the CLI press Ctrl-C.

SELECT select_expr [, ...]
        FROM from_item [, ...]
        [ WINDOW window_expression ]
        [ WHERE condition ]
        [ GROUP BY grouping_expression ]
        [ HAVING having_expression ];

SELECT CAST expression type

Casts an expression's type to a new type.

CAST (expression AS data_type);

For example, to convert BIGINT to VARCHAR type:

SELECT page_id, CONCAT(CAST(COUNT(*) AS VARCHAR), '_HELLO')
  FROM pageviews_enriched
  WINDOW TUMBLING (SIZE 20 SECONDS)
  GROUP BY page_id;

SELECT LIKE operator

The LIKE operator is used for prefix or suffix matching. Currently KSQL supports %, which represents zero or more characters.

column_name LIKE pattern;

For example:

SELECT user_id
  FROM users
  WHERE user_id LIKE 'santa%';