Master Snowflake SQL Select From Values with Examples

Kevin Jul 13, 2026

The power of Snowflake's SQL lies in its ability to handle large datasets with ease, and one of its versatile features is the SELECT ... FROM VALUES clause. This clause allows you to inject data directly into your query, transforming it into a powerful tool for generating, manipulating, and testing data.

a snowflake is shown with several different types of technology in the center and below it
a snowflake is shown with several different types of technology in the center and below it

In this article, we'll delve into the intricacies of using SELECT FROM VALUES in Snowflake, explaining its benefits, syntax, and practical applications. Whether you're a seasoned data professional or just starting your journey, this guide will help you unlock the full potential of this feature.

Star Schema vs Snowflake schema for Data Warehouse
Star Schema vs Snowflake schema for Data Warehouse

Understanding SELECT FROM VALUES

The SELECT ... FROM VALUES clause is a Snowflake-specific extension that enables you to create a temporary table containing values defined in your query. This table can then be used for further operations, such as joining, aggregating, or filtering data.

Master Snowflake Data Types for Better Data Performance
Master Snowflake Data Types for Better Data Performance

One of the primary advantages of using SELECT FROM VALUES is its ability to generate data on the fly, simplifying tasks that would otherwise require creating and managing tables or files. By leveraging this feature, you can test queries, create sample datasets, or even perform comparisons between different data sources.

Syntax demystified

snowflakes are shown in blue and white, with the same amount as each other
snowflakes are shown in blue and white, with the same amount as each other

To comprehend the SELECT ... FROM VALUES clause better, let's break down its syntax:

  • SELECT - The SQL command that retrieves data from one or more databases.
  • column1, column2, ... - The names of the columns you want to create in the temporary table. You can specify any number of columns, depending on your needs.
  • FROM - The keyword that separates the column names from the data source.
  • VALUES - A placeholder indicating that you'll be providing the data values directly in the query.
  • (value1, value2, ...), (value3, value4, ...), ... - The data you want to insert into the temporary table. Each row is enclosed in parentheses, and each value is separated by commas.

The basic structure of the SELECT ... FROM VALUES clause can be represented as:

SQL Query Execution Order Explained | Logical Order of SQL Query Processing
SQL Query Execution Order Explained | Logical Order of SQL Query Processing

SELECT column1, column2, ...
FROM VALUES
  (value1, value2, ...),
  (value3, value4, ...),
  ...

Now that we've covered the basics, let's explore some practical applications of this clause.

Practical applications of SELECT FROM VALUES

Creating sample data

Learn SQL Fast 🚀 | Beginner SQL Commands Cheat Sheet for Data Analysts
Learn SQL Fast 🚀 | Beginner SQL Commands Cheat Sheet for Data Analysts

One of the most compelling use cases for SELECT ... FROM VALUES is creating sample data for testing purposes. Often, you might want to try out a query or function before applying it to your actual datasets. By using this clause, you can generate sample data with ease:

SELECT * FROM (
  SELECT * FROM VALUES
    ('John Doe', 30, 'Engineer'),
    ('Jane Smith', 28, 'Data Scientist')
) AS sample_data;

This query creates a temporary table called sample_data containing two records, allowing you to test your queries without touching your production data.

Resource Library
Resource Library
SQL in 60 days
SQL in 60 days
an image of a diagram with the words,'the sq circle'in different languages
an image of a diagram with the words,'the sq circle'in different languages
Snowflake Data Modeling Guide: Boost Performance & Cut Costs
Snowflake Data Modeling Guide: Boost Performance & Cut Costs
7 SQL Projects for Beginners | Build a Real Data Portfolio
7 SQL Projects for Beginners | Build a Real Data Portfolio
an abstract snowflake is shown on a black background with blue and white colors
an abstract snowflake is shown on a black background with blue and white colors
a whiteboard with some writing on it and an image of the words in different colors
a whiteboard with some writing on it and an image of the words in different colors
Top 5 Best Practices for Data Warehouse Management | Improve Data Efficiency
Top 5 Best Practices for Data Warehouse Management | Improve Data Efficiency
SQL Basics Cheat Sheet for Beginners | Learn SQL Fast 💻
SQL Basics Cheat Sheet for Beginners | Learn SQL Fast 💻
snowflake vs data bricks info sheet
snowflake vs data bricks info sheet
SQL CASE WHEN Explained with Examples | Beginner SQL Tutorial
SQL CASE WHEN Explained with Examples | Beginner SQL Tutorial
SQL
SQL
SQL Basics Tutorial for Beginners – Structured Query Language Commands, Syntax & Examples Guide
SQL Basics Tutorial for Beginners – Structured Query Language Commands, Syntax & Examples Guide
SQL Joins Explained with Examples | Complete JOIN Cheat Sheet for Beginners
SQL Joins Explained with Examples | Complete JOIN Cheat Sheet for Beginners
SQL Cheatsheet In 2026 🚀
SQL Cheatsheet In 2026 🚀
a table that has some words on it
a table that has some words on it
Snowflake Data Migration Checklist (6 Phases for Success)
Snowflake Data Migration Checklist (6 Phases for Success)
SQL ISNULL() Explained with Examples | Replace NULL Values in SQL Server
SQL ISNULL() Explained with Examples | Replace NULL Values in SQL Server
SQL Basics For Beginners
SQL Basics For Beginners

Comparing data sources

In some cases, you might want to compare the results from different data sources or query methods. The SELECT ... FROM VALUES clause makes it simple to create a unified view for comparison:

SELECT * FROM (
  SELECT * FROM my_table
  UNION ALL
  SELECT * FROM VALUES
    (100, 'New York'),
    (200, 'London')
) AS combined_data;

In this example, a temporary table is created using the UNION ALL operator, allowing you to combine and compare data from two different sources.

Best practices and considerations

While the SELECT ... FROM VALUES clause offers tremendous flexibility, it's essential to keep a few best practices in mind to maximize its benefits:

-трупност и безопасност

First and foremost, always ensure that the data you're inserting using this clause doesn't compromise the security or integrity of your Snowflake account. Avoid running queries with sensitive information, as the created temporary table may still be accessible.

Additionally, keep an eye on your resource consumption, as creating and manipulating large temporary tables can consume significant amounts of CPU and memory. Try to limit the size of your temporary tables to prevent performance issues or excessive costs.

-talet Lungime and performance

Although the SELECT ... FROM VALUES clause is highly efficient for small datasets, its performance may degrade as the number of rows increases. As a rule of thumb, try to keep the size of your temporary tables reasonable, and consider using other methods (such as staging tables or files) for large-scale data manipulation tasks.

Another crucial aspect to consider is the lifespan of your temporary tables. By default, temporary tables created using this clause exist only for the duration of the session. To ensure consistent results, make sure to recreate your temporary tables after each Snowflake session restart.

In conclusion, the SELECT ... FROM VALUES clause is an invaluable tool in the Snowflake arsenal, empowering users to generate, manipulate, and test data with ease. By understanding its syntax, practical applications, and best practices, you'll be well on your way to mastering this versatile feature. Embrace the power of SELECT ... FROM VALUES and elevate your Snowflake experience to new heights!