How to See Custom SQL Query in Tableau

Published: May 1, 2024 - 4 min read

Julian Alvarado

Are you struggling to get the most out of your data in Tableau? Viewing and running custom SQL queries can be a game-changer, allowing you to slice and dice your data exactly how you need it.

But figuring out how to access this functionality isn’t always intuitive.

Don’t worry, this blog post will walk you through the entire process step-by-step, complete with screenshots. By the end, you’ll know exactly how to see custom SQL queries in Tableau, unlocking deeper insights and more powerful data analysis.

Getting Started: Preparing Your Data for How to See Custom SQL Query in Tableau

Teams often rely on updated spreadsheets or databases to power their Tableau dashboards. However, writing custom SQL queries to extract and transform this data can be a time-consuming and complex task.

Coefficient simplifies this process by allowing you to write custom SQL queries directly within your spreadsheet, making it easy to get the data you need into Tableau.

oefficient simplifies this process by allowing you to write custom SQL queries directly within your spreadsheet

Now, let’s dive into how you can view custom SQL queries in Tableau.

See Custom SQL Query in Tableau: Step-by-Step Tutorial

Step 1. Connect to a Database for How to See Custom SQL Query in Tableau

The critical first step is to connect Tableau to the database or server that contains the data you want to query. Without this connection, you won’t be able to write or view custom SQL.

oefficient simplifies this process by allowing you to write custom SQL queries directly within your spreadsheet

Step 2. Select Project and Dataset for How to See Custom SQL Query in Tableau

Once connected, select the project and dataset that contains the table you want to query. This will allow you to access that data in Tableau.

After connecting to the database, select the specific project and dataset containing the table to query.

Once connected, select the project and dataset that contains the table you want to query. This will allow you to access that data in Tableau.

Step 3. Bring Table into Tableau for How to See Custom SQL Query

To start working with a table, simply drag and drop or double-click it to bring it into Tableau’s workspace area.

Drag and drop or double-click the desired table to bring it into Tableau's workspace.

Step 4. Convert Table for How to See Custom SQL Query in Tableau

Right-click on the table you want to query and look for the option to convert it to a custom SQL view. This will allow you to write custom queries against that data.

Right-click on the table and select the option to convert it to a custom SQL view.

Step 5. Select Data for How to See Custom SQL Query in Tableau

Decide which columns or pieces of data you want to include in your custom query by selecting them in the custom SQL editor view.

In the custom SQL editor, select the columns or data elements you want to include in the query.

Step 6. Write Custom SQL for How to See Custom SQL Query in Tableau

Now it’s time to write your custom SQL query. Click the ‘New Custom SQL’ to open the editor.

Coefficient Excel Google Sheets Connectors
Try the Free Spreadsheet Extension Over 314,000 Pros Are Raving About

Stop exporting data manually. Sync data from your business systems into Google Sheets or Excel with Coefficient and set it on a refresh schedule.

Get Started

In the editor, type out the full query, including any filters, conditions, or calculations you need to get the desired data view.

Type out the desired SQL query, including any filters or conditions, in the custom SQL editor.

Step 7. Preview Results for How to See Custom SQL Query in Tableau

Before committing to the custom query, preview the results to make sure it is returning the data you want and expect. This allows you to catch and fix any errors.

Before finalizing, preview the results of the custom SQL query to ensure it is returning the expected data.

Step 8. Create Custom SQL Table for How to See Custom SQL Query in Tableau

If everything looks good, click OK to generate a new table in Tableau based on your custom SQL query.

This table can then be used for analysis and visualization like any other data source.

Click OK to generate a new table in Tableau based on the custom SQL query.

If everything looks good, click OK to generate a new table in Tableau based on your custom SQL query. This table can then be used for analysis and visualization like any other data source.

Tips and Tricks for Custom SQL Queries in Tableau

  • Leverage Tableau’s auto-complete functionality to write SQL queries faster
  • Break down complex queries into readable chunks using indentation and comments  
  • Periodically refresh data sources to ensure custom SQL queries run on the latest data
  • Save custom SQL queries as views or table calculations for easy reuse

SQL Queries in Tableau? Start With Coefficient.  

With the power to write and view custom SQL queries in Tableau, you now have unprecedented control over your data analysis.

Don’t settle for Tableau’s limitations – unlock deeper insights by querying your data exactly how you need to.

With Coefficient, you can write custom SQL queries to extract data from various sources, including MySQL, PostgreSQL, MS SQL, Snowflake, and RedShift. This gives you the flexibility to query your data exactly how you need it, without being limited by pre-built connectors or data sources.

Get started with Coefficient today and seamlessly integrate live data into your Tableau workflow.

Connect Tableau to Spreadsheets Instantly

Automatically sync Tableau with Google Sheets or Excel using Coefficient’s one-click connector.

Try the Spreadsheet Automation Tool Over 350,000 Professionals are Raving About

Tired of spending endless hours manually pushing and pulling data into Google Sheets? Say goodbye to repetitive tasks and hello to efficiency with Coefficient, the leading spreadsheet automation tool trusted by over 350,000 professionals worldwide.

Sync data from your CRM, database, ads platforms, and more into Google Sheets in just a few clicks. Set it on a refresh schedule. And, use AI to write formulas and SQL, or build charts and pivots.

Julian Alvarado Content Marketing
Julian is a dynamic B2B marketer with 8+ years of experience creating full-funnel marketing journeys, leveraging an analytical background in biological sciences to examine customer needs.
350,000+ happy users
Wait, there's more!
Connect any system to Google Sheets in just seconds.
Get Started Free

Trusted By Over 20,000 Companies