liveBook · Manning

Select

As explained in Snowflake Data Engineering

A SQL command that retrieves rows or computed expressions from tables, stages, or other queryable sources.

SELECT retrieves and previews data from Snowflake queryable sources, including tables and internal or external stages. When reading staged files, it exposes file fields with positional references such as $1, $2, and $3 rather than SELECT *. section 2.3 section 5.2.2

Use SELECT on staged data to inspect file structure before ingestion or extract fields for staging tables:

  • CSV files expose fields by position, with delimiters determining the columns; a five-column file can be inspected with $1 through $5. section 2.3
  • Semistructured files such as JSON expose each record as a column, which can then be navigated through expressions such as $1:"Order id". section 5.2.2
  • SELECT previews staged content; COPY loads it into a staging table, while later MERGE and transformations support downstream pipeline work. section 2.6
select $1, $2, $3, $4, $5 from @ORDERS_STAGE;

Inspect all five fields in the staged CSV file using positional references. section 2.3

select $1 from @SPEEDY_STAGE;

Preview each JSON record from the external stage as a single VARIANT column. section 5.2.2

Extract JSON fields and metadata

SELECT $1:"Order id", $1:"Order datetime", $1:"Items", metadata$filename, current_timestamp() FROM @SPEEDY_STAGE; section 5.2.2

How Snowflake Data Engineering covers it

How deep it goes
Explains positional CSV fields, JSON extraction, and stage previews, but defers broader query syntax and optimization.
Examples
Uses bakery orders in CSV stages and delivery-service orders in JSON stages.
What it assumes
Assumes an accessible Snowflake stage and teaches file-field selection without requiring a predefined file schema.
What you can do after
Apply it via Snowflake SQL to inspect staged files and select structured or semistructured fields for ingestion.
How it connects
Connects SELECT with stages, file formats, COPY, MERGE, Snowpipe, and SQL transformations.

Also explained in

Compare how 5 books explain select →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Snowflake Data Engineering. The section links point to the parts of the book it draws on.