Workflow: Selecting observations from a dataset using the SQL block


The SQL block enables you to create a dataset using the SQL language SELECT statements in a Workflow.

The following demonstrates now to use the SQL block to select the variables Title and In_Stock from the input dataset lib_books.csv (which contains observations that describe a range of books available from a lending library) and output them to a new dataset.

  1. Import the lib_books.csv dataset into a Workflow using the Text File Import block.
  2. Expand the Code Blocks group in the Workflow palette, then click and drag an SQL block onto the Workflow canvas.
  3. Click the Output port of the lib_books dataset block and drag a connection towards the Input port of the SQL Language block.
  4. Double-click on the SQL block to display the SQL editor view.
  5. In the SQL editor view enter the following:
    SELECT Title, In_Stock FROM "Working Dataset";

  6. Close the SQL editor view and save the configuration when prompted.

A green execution status is displayed in the Output ports of the SQL block and the new Working Dataset. The dataset contains the title of all books in the library collection and whether those books are available for loan.