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
[ LEFT JOIN join_table ON join_criteria ]
[ WINDOW window_expression ]
[ WHERE condition ]
[ GROUP BY grouping_expression ]
[ HAVING having_expression ]
EMIT CHANGES
[ LIMIT count ];

SELECT CAST expression type

Casts an expression's type to a new type.

CAST (expression AS data_type);
SELECT userid, CONCAT(CAST(COUNT(*) AS VARCHAR), '_HELLO')
FROM pageviews
WINDOW TUMBLING (SIZE 20 SECONDS)
GROUP BY userid
EMIT CHANGES;

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;
SELECT userid
FROM pageviews
WHERE userid LIKE '%4'
EMIT CHANGES;