A WHERE clause filters query results to rows whose Boolean condition is true. In a ksqlDB activity-leaders query, it can limit a live client subscription to users with more than 1,000 steps. section 11.3
Filter a live query
SELECT last_name, activity, total_steps FROM activity_leaders WHERE total_steps > 1000 EMIT CHANGES; The push query returns matching updates without storing these results. Adding LIMIT 10 caps the returned updates. section 11.3
A WHERE condition can inspect:
- Regular columns defined by the stream or table, such as total_steps. section 11.3
- ROWTIME, ROWPARTITION, and ROWOFFSET, which ksqlDB attaches to incoming Kafka records. section 11.3
- A key lookup in a pull query, such as WHERE key_1 = 'Smith'. section 11.3
Listing 11.19 Push query with WHERE clause
SELECT, last_name, activity, total_steps FROM activity_leaders WHERE total_steps > 1000 EMIT CHANGES;
Inspect the complete filtered push-query listing. section 11.3






