Get Started Free
course: ksqlDB 101

Hands On: Splitting Two Streams with ksqlDB

2 min
Allison

Allison Walther

Integration Architect (Presenter)

Hands On: Splitting Two Streams with ksqlDB

This exercise will demonstrate how to split streams in ksqlDB.

Inspect Your Existing Data

  1. Begin by looking at the orders_combined stream from the module 9 exercise, which has orders from both the US and the UK:

    SELECT * FROM orders_combined EMIT CHANGES;

    Click Run query and see that the results contain orders from both the US and the UK.

Create New Split Streams

  1. Create a new stream to contain only orders from the US:

    CREATE STREAM us_orders AS
    SELECT * FROM orders_combined
    WHERE source = 'US';

    Click Run query.

  2. Create another new stream to contain only orders from the UK:

    CREATE STREAM uk_orders AS
    SELECT * FROM orders_combined
    WHERE source = 'UK';

    Click Run query.

Inspect Your Data Using the Flow Tab

  1. Move to the Flow tab. Click on the US_ORDERS stream. On the right-hand side, you see that the stream contains only orders from the US. Click on the UK_ORDERS stream and you see that it likewise contains only orders from the UK.

Use the promo code KSQLDB101 to get $25 of free Confluent Cloud usage

Be the first to get updates and new content

We will only share developer content and updates, including notifications when new content is added. We will never send you sales emails. 🙂 By subscribing, you understand we will process your personal information in accordance with our Privacy Statement.