SQL / LEARNING MAP
SQL Overview
Explore SQL through statement categories and data types. Compare Snowflake and BigQuery types and when to use them, then follow links to syntax and function examples.
Explore by purpose
SQL is a language for database structures, reading and changing data, access permissions and transactions. The five categories below organize statements by purpose.
DDLData definition
CREATE · ALTER · DROP
DMLData manipulation
INSERT · UPDATE · DELETE · MERGE
DQLQueries and analysis
SELECT · JOIN · GROUP BY · OVER
DCLAccess control
GRANT · REVOKE
TCLTransaction control
BEGIN · COMMIT · ROLLBACK
Choose data types by purpose
A type defines a value’s domain and supported operations. Types matter in column definitions and in SELECT or UPDATE expressions; they are a separate axis from the five statement categories.
Compare Snowflake with BigQuery GoogleSQL. Each row matches a purpose, not full type compatibility. Type names link to official specifications.
| Purpose / example | Snowflake | BigQuery | Choice / differences |
|---|---|---|---|
Integers / counts42 | NUMBER(p,0) · INT / INTEGER / BIGINT | INT64 · INT / INTEGER / BIGINT | Snowflake integer aliases mean NUMBER(38,0); BigQuery aliases mean signed 64-bit INT64. BIGINT has different ranges. |
Decimals / money1234.50 | NUMBER(p,s) · DECIMAL · NUMERIC | NUMERIC · BIGNUMERIC · DECIMAL · BIGDECIMAL | Use decimal values at a defined precision. p is total digits; s is fractional digits. For money, define the required scale and rounding rule. |
Approximate numbers / measurements0.1 | FLOAT · DOUBLE · REAL | FLOAT64 | Binary floating point cannot represent values such as 0.1 exactly. Allow for rounding error; consider fixed-point types for exact monetary totals. |
Text / identifier codes'00123' | VARCHAR(n) · STRING · TEXT · CHAR | STRING · STRING(L) | Keep codes as text when leading zeros matter. Snowflake CHAR is a VARCHAR alias, not a blank-padded fixed-width type. |
Bytes / hashes0xFF | BINARY · VARBINARY | BYTES · BYTES(L) | Data without character encoding semantics. A hexadecimal display string and its underlying bytes are different values. |
Booleans / conditionsTRUE / FALSE | BOOLEAN | BOOL · BOOLEAN | A nullable column can also be unknown. WHERE keeps only rows whose condition is TRUE. |
Dates / business days2026-11-13 | DATE | DATE | A calendar date only. Specify the business time zone when deriving a date from an event instant. |
Time of day / opening time09:30:00 | TIME | TIME | No date or time zone. Represent elapsed time with INTERVAL or numbers with an explicit unit. |
Civil date and time2026-11-13 09:30:00 | TIMESTAMP_NTZ · DATETIME | DATETIME | A date and clock reading. Without a time zone it does not identify a unique global instant. |
Instants / event timestamps2026-11-13 00:30:00Z | TIMESTAMP_LTZ · TIMESTAMP_TZ | TIMESTAMP | LTZ uses the session time zone; TZ retains an offset. BigQuery does not store a time zone itself. See details below. |
DurationsP3M / PT2H | INTERVAL YEAR TO MONTH · INTERVAL DAY TO SECOND | INTERVAL | A duration without endpoints. One month is not the same as 30 days. Snowflake separates year-month and day-time types. |
Ranges with endpoints[2026-11-01, 2026-12-01) | PERIOD(DATE) · PERIOD(TIMESTAMP_NTZ) | RANGE<DATE> · RANGE<DATETIME> · RANGE<TIMESTAMP> | Includes the start and excludes the end. Snowflake PERIOD requires finite bounds; constraints differ from BigQuery RANGE. |
Flexible structures / JSON{"id": 42} | VARIANT · OBJECT · ARRAY | JSON | Parse JSON text before treating it as structured data. VARIANT is not limited to JSON. Distinguish SQL NULL from JSON null. |
Ordered collections[1, 2, 3] | ARRAY · ARRAY(NUMBER) | ARRAY<INT64> | Snowflake has semi-structured and typed arrays. BigQuery specifies an element type and disallows directly nested arrays. |
Records / key-value mapsid + name | OBJECT(id NUMBER, name VARCHAR) · MAP(VARCHAR, NUMBER) | STRUCT<id INT64, name STRING> | Typed OBJECT defines fields; MAP defines key and value types. STRUCT and MAP are not interchangeable. |
Geospatial dataPOINT(139.7 35.6) | GEOGRAPHY · GEOMETRY | GEOGRAPHY | GEOGRAPHY models the Earth’s surface; Snowflake GEOMETRY uses a plane. Check coordinate systems, units and functions. |
Special-purpose and product-specific types
These entries are reference links. Distinguish stored column types from types restricted to particular expressions or features; check availability in each reference.
- Snowflake
DECFLOAT·VECTOR(INT|FLOAT, dimension)·FILE·IPADDRESS·UUID·UNKNOWN (Iceberg)·User-defined types- BigQuery
GRAPH_ELEMENT·GRAPH_PATH·MEASURE
Check the distinctions that matter
Define precision and rounding
NUMBER(5,2) allows three integer digits and two fractional digits, up to 999.99. Bare Snowflake NUMBER defaults to (38,0). BigQuery NUMERIC has precision 38 and scale 9; BIGNUMERIC has about 76.8 digits and scale 38. Parameterized forms such as NUMERIC(P,S) have additional constraints. Distinguish fractional rounding from integer overflow.
Separate civil time, instants and time zones
Tokyo 2026-11-13 09:30 and UTC 2026-11-13 00:30 denote the same instant. Snowflake TIMESTAMP defaults to NTZ but depends on configuration, so name the intended variant. LTZ displays UTC values in the session zone; TZ retains an offset, not a region such as Asia/Tokyo. Store the instant and region separately when regional rules matter.
Distinguish NULL, empty text and zero
NULL marks missing or unknown data; it is not a type family. '' is an empty string, 0 a number, and 'NULL' a four-character string. Use IS NULL; even NULL = NULL is not TRUE. COUNT(*) counts rows; COUNT(column) counts non-NULL values. JSON null and NULL in arrays have product-specific rules.
Separate convertibility from accepted format
CAST requests an explicit conversion. Implicit conversion can change comparison or arithmetic types. Snowflake TRY_CAST returns NULL on failure but accepts string inputs and only selected targets. BigQuery SAFE_CAST still rejects impossible type pairs during static analysis. Retain the original value to distinguish missing input from conversion failure.
Check for digits only
Compare '123', '123.' and '12a'. If the rule is one or more ASCII digits 0–9, match the entire string with a regular expression. Allowing decimals, signs or spaces is a separate decision. Successful conversion does not prove that the original format met your rule.
Read-only examples. Results below are expected values; this page does not execute SQL.
WITH sample AS (
SELECT '123' AS raw_value
UNION ALL SELECT '123.'
UNION ALL SELECT '12a'
)
SELECT raw_value,
REGEXP_LIKE(raw_value, '^[0-9]+$') AS digits_only
FROM sample
ORDER BY raw_value;WITH sample AS (
SELECT '123' AS raw_value
UNION ALL SELECT '123.'
UNION ALL SELECT '12a'
)
SELECT raw_value,
REGEXP_CONTAINS(raw_value, r'^[0-9]+$') AS digits_only
FROM sample
ORDER BY raw_value;| raw_value | digits_only |
|---|---|
'123' | TRUE |
'123.' | FALSE |
'12a' | FALSE |
References checked · 2026-11-13
Snowflake · typesBigQuery · typesSnowflake · CASTSnowflake · TRY_CASTBigQuery · SAFE_CASTSnowflake · REGEXP_LIKEBigQuery · REGEXP_CONTAINS
Continue to syntax and functions