Create a table within a Custom SQL Dataset

Hello,

In my SQL query I have 2 temp tables, one being a query output from other tables, while the other being a created table with fixed historical values. The result of the query is the union of these two tables (my goal is to be able to compare current output vs historical).

I’m now trying to transpose this in a Quicksight dataset, but it’s returning error on the created table (specifically it gives error when I use CREATE TABLE table1 (column_name format …). What is the correct language to create a table (and insert values) in Quicksight?

If this is not feasible, I though of creating 2 datasets (one with my query, the other with historical values in excel format), but how can I union/collate the two?

Thank you,
Davide

Hi @Davide_Telo

Welcome to the community!

Quick Sight SQL editor is designed to query existing data sources like databases and does not support creating or inserting into tables like a typical SQL database. You need to use the CREATE TABLE or INSERT INTO commands within your database’s SQL query editor.

If possible, it might be easier to prepare the data by combining it at the source database level (e.g., using SQL Server, Redshift, Athena, Snowflake, etc.), and then directly import the combined dataset into Quick Sight.

1 Like

Hi, thank you for the quick reply! The workaround I found is to use UNION ALL in Quicksight SQL editor for each row I want to add. This is not efficient but it works if the rows are limited.

2 Likes