Creating a table

As a first step to use the Community Edition, learn how to create a table that generates random data using the included Faker connector after accessing the Streaming SQL Console.

When you access the Streaming SQL Console, you are redirected to the homepage of the SQL Stream Builder user interface. The homepage of Streaming SQL Console is the Console page. On the Console page, you can easily create and submit your SQL queries in the SQL window.

As a first step in executing a SQL query, you need to create a table. At this point, you can use the predefined templates under the SQL window.

Use the following CREATE TABLE statement, and paste it to the SQL window.

DROP TABLE IF EXISTS orders;
CREATE TABLE  orders (
  order_id INTEGER,
  city STRING,
  street_address STRING,
  amount INTEGER,
  order_time TIMESTAMP(3),
  order_status STRING,
   WATERMARK FOR `order_time` AS order_time - INTERVAL '15' SECOND
) WITH (
  'connector' = 'faker',
  'rows-per-second' = '1',
  'fields.order_id.expression' = '#{number.numberBetween ''0'',''99999999''}',
  'fields.city.expression' = '#{Address.city}',
  'fields.street_address.expression' = '#{Address.street_address}',
  'fields.amount.expression' = '#{number.numberBetween ''0'',''100''}',
  'fields.order_time.expression' = '#{date.past ''15'',''SECONDS''}',
  'fields.order_status.expression' = '#{regexify ''(RECEIVED|PREPARING|DELIVERING|DELIVERED|CANCELED){1}''}'
);

To create the table, you need to click on the Execute button under the SQL window.

After executing the CREATE TABLE statement, there are two ways to view the created table:
  • You can view the table under the Tables tab by clicking the plus icon in front of the database name:
  • After returning to the Compose window, you can replace the earlier statemen by DESCRIBE orders;, and click Execute again: