SQL Console

After applying the above, the query can now be viewed (and executed) by all team members with access to the SQL console for the service.

To adjust query access for specific members, select the desired team member from the "Add a team member" selector:

After selecting a team member, a new line item should appear with an access level selector:

### Accessing shared queries[​](#accessing-shared-queries "Direct link to Accessing shared queries")

If a query has been shared with you, it will be displayed in the "Queries" tab of the SQL console left sidebar:

### Linking to a query (permalinks)[​](#linking-to-a-query-permalinks "Direct link to Linking to a query (permalinks)")

Saved queries are also permalinked, meaning that you can send and receive links to shared queries and open them directly.

Values for any parameters that may exist in a query are automatically added to the saved query URL as query parameters. For example, if a query contains `{start_date: Date}` and `{end_date: Date}` parameters, the permalink can look like: `https://console.clickhouse.cloud/services/:serviceId/console/query/:queryId?param_start_date=2015-01-01&param_end_date=2016-01-01`.

## Advanced querying features[​](#advanced-querying-features "Direct link to Advanced querying features")

### Searching query results[​](#searching-query-results "Direct link to Searching query results")

After a query is executed, you can quickly search through the returned result set using the search input in the result pane. This feature assists in previewing the results of an additional `WHERE` clause or simply checking to ensure that specific data is included in the result set. After inputting a value into the search input, the result pane will update and return records containing an entry that matches the inputted value. In this example, we'll look for all instances of `breakfast` in the `hackernews` table for comments that contain `ClickHouse` (case-insensitive):

Note: Any field matching the inputted value will be returned. For example, the third record in the above screenshot doesn't match 'breakfast' in the `by` field, but the `text` field does:

### Adjusting pagination settings[​](#adjusting-pagination-settings "Direct link to Adjusting pagination settings")

By default, the query result pane will display every result record on a single page. For larger result sets, it may be preferable to paginate results for easier viewing. This can be accomplished using the pagination selector in the bottom right corner of the result pane:

Selecting a page size will immediately apply pagination to the result set and navigation options will appear in the middle of the result pane footer

### Exporting query result data[​](#exporting-query-result-data "Direct link to Exporting query result data")

Query result sets can be easily exported to CSV format directly from the SQL console. To do so, open the `•••` menu on the right side of the result pane toolbar and select 'Download as CSV'.

## Visualizing query data[​](#visualizing-query-data "Direct link to Visualizing query data")

Some data can be more easily interpreted in chart form. You can quickly create visualizations from query result data directly from the SQL console in just a few clicks. As an example, we'll use a query that calculates weekly statistics for NYC taxi trips:

```
SELECT
   toStartOfWeek(pickup_datetime) AS week,
   sum(total_amount) AS fare_total,
   sum(trip_distance) AS distance_total,
   count(*) AS trip_total
FROM
   nyc_taxi
GROUP BY
   1
ORDER BY
   1 ASC
```

Without visualization, these results are difficult to interpret. Let's turn them into a chart.

### Creating charts[​](#creating-charts "Direct link to Creating charts")

To begin building your visualization, select the 'Chart' option from the query result pane toolbar. A chart configuration pane will appear:

We'll start by creating a simple bar chart tracking `trip_total` by `week`. To accomplish this, we'll drag the `week` field to the x-axis and the `trip_total` field to the y-axis:

Most chart types support multiple fields on numeric axes. To demonstrate, we'll drag the fare\_total field onto the y-axis:

### Customizing charts[​](#customizing-charts "Direct link to Customizing charts")

The SQL console supports ten chart types that can be selected from the chart type selector in the chart configuration pane. For example, we can easily change the previous chart type from Bar to an Area:

Chart titles match the name of the query supplying the data. Updating the name of the query will cause the Chart title to update as well:

A number of more advanced chart characteristics can also be adjusted in the 'Advanced' section of the chart configuration pane. To begin, we'll adjust the following settings:

- Subtitle
- Axis titles
- Label orientation for the x-axis

Our chart will be updated accordingly:

In some scenarios, it may be necessary to adjust the axis scales for each field independently. This can be done in the 'Advanced' section of the chart configuration pane by specifying min and max values for an axis range. As an example, the above chart looks good, but to demonstrate the correlation between our `trip_total` and `fare_total` fields, the axis ranges need some adjustment:

- [Exploring tables](#exploring-tables)- [Viewing table list and schema info](#viewing-table-list-and-schema-info)- [Exploring table data](#exploring-table-data)- [Inspecting cell data](#inspecting-cell-data)- [Filtering and sorting tables](#filtering-and-sorting-tables)
          - [Sorting a table](#sorting-a-table)- [Filtering a table](#filtering-a-table)- [Filtering and sorting together](#filtering-and-sorting-together)- [Creating a query from filters and sorts](#creating-a-query-from-filters-and-sorts)- [Creating and running a query](#creating-and-running-a-query)
            - [Creating a query](#creating-a-query)- [Running a query](#running-a-query)- [Canceling a query](#canceling-a-query)- [Saving a query](#saving-a-query)- [Query sharing](#query-sharing)- [Accessing shared queries](#accessing-shared-queries)- [Linking to a query (permalinks)](#linking-to-a-query-permalinks)- [Advanced querying features](#advanced-querying-features)
              - [Searching query results](#searching-query-results)- [Adjusting pagination settings](#adjusting-pagination-settings)- [Exporting query result data](#exporting-query-result-data)- [Visualizing query data](#visualizing-query-data)
                - [Creating charts](#creating-charts)- [Customizing charts](#customizing-charts)

Was this page helpful?