Create a VIEW on the foreign stream that performs a basic calculation

<< Click to Display Table of Contents >>

Navigation:  Building Streaming Applications > Tutorial 2: Introduction to Coding with Streaming SQL > Tutorial 2A: Creating a Stream and View in SQLstream s-Studio >

Create a VIEW on the foreign stream that performs a basic calculation

Previous pageReturn to chapter overviewNext page

Now that we've created a foreign stream, we want to perform a basic calculation on this stream. To do so, we'll create a new object called a view.

1.Click on Buses_Schema to expand it.
2.Right-click Views and select New.
3.In the dialog box that opens, enter speeders for the name of the view.


4.Click OK. A tab opens reading speeders (View).
5.If it is not already open, click the SQL tab at the bottom of the speeders (View) tab.
6.In the SQL window, complete the statement by entering the following text:

 SELECT STREAM * FROM "buses"."buses_stream" where "speed" > 75



This tells s-Server, "get me all of the columns in a stream called buses_stream in a schema called buses where the column speed is greater than 75."

7.Click the Definition tab. Note that all columns for the buses_stream stream appear here, and that buses_stream appears as a dependency for the view. Dependencies refer to objects referenced by the view.


8.Note that the speeders(View) tab has an asterisk next to it. This indicates that the view has not been saved. Choose File > Save (or Ctrl-S) to save the view.