Example dataset views in Postman

Beta
View as Markdown

Datasets are available on Postman Solo, Team, and Enterprise plans. For more information, see the pricing page.

Views use SQL to define how data is retrieved from your dataset. By default, views use SQLite-compatible syntax and functions. If a dataset has only one external data source type, such as MySQL or PostgreSQL, you can also use syntax and functions specific to that data source.

The following examples show common ways to use views with different data sources.

About the example dataset

In the following examples, assume you have a dataset with the following data sources:

  • A local CSV file named users with the following data:

    1userId,firstName,lastName,email
    21,John,Doe,john.doe@example.com
    32,Jane,Smith,jane.smith@example.com
    43,Bob,Johnson,bob.johnson@example.com
  • A MySQL database named orders with the following data:

    | orderId | userId | amount |
    |---------|--------|--------|
    | 101 | 1 | 50.00 |
    | 102 | 2 | 75.00 |
    | 103 | 3 | 25.00 |

Select all data

You can create a view that selects all rows and columns.

1SELECT * FROM source_users;

Filter rows

You can filter rows to return only the data your workflow needs.

1SELECT email, firstName, lastName
2FROM source_users
3WHERE userId = '2';

Create new columns

You can create new columns using expressions and aliases in your query. This is useful when your tests or mock servers need values derived from existing data.

SQLite example:

1SELECT firstName, lastName, firstName || ' ' || lastName AS fullName
2FROM source_users;

MySQL example:

1SELECT orderId, amount, CONCAT(orderId, ' ', amount) AS orderSummary
2FROM source_orders;

Join multiple data sources

You can combine data from multiple data sources, such as a local CSV file and a MySQL table. This is useful when you want a consolidated view of data that’s stored in different places.

1SELECT source_users.userId, source_users.firstName, source_users.lastName, source_orders.orderId, source_orders.amount
2FROM source_users
3JOIN source_orders ON source_users.userId = source_orders.userId;