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




