AI_SIMILARITY is a Snowflake Cortex AI SQL function that returns a float between 0 and 1 representing semantic similarity between two text strings. Unlike traditional string comparison functions like EDITDISTANCE or JAROWINKLER_SIMILARITY, it understands meaning rather than just characters. The guide walks through 7 practical use cases with full SQL examples: basic string comparison, boundary value testing, semantic search with ranking, threshold-based filtering, cross-row self-join comparisons, fuzzy deduplication of company names, and zero-shot category prediction using CASE/GREATEST. The function works as a scalar that drops into SELECT, WHERE, ORDER BY, or CASE clauses. Advanced tips include combining it with AI_EMBED to pre-compute embeddings and AI_FILTER for two-pass pipelines.
Sort: