Get startedGet started for free

Text data types

1. Text data types

Thanks for joining me! I'm Jake, and I couldn't be more excited to be your guide as we journey into Snowflake data types and functions. Let's get started!

2. Data types and functions in Snowflake

In the data world, Snowflake is one of the most popular tools for storing, processing, and analyzing data. Don't believe me? Well, Snowflake is used by more than 10,000 organizations globally. Together, we'll explore the ins-and-outs of data types in Snowflake. Then, we'll learn to manipulate this data, before honing more advanced techniques. First up, it's time to learn a bit more about text data in Snowflake.

3. Snowflake text data

Text data is one of the most popular data types in Snowflake. It can be used to store categorical values, like `Software Engineer` or a message like `Hello, World!`. Text data can be used to store things like phone numbers and unstructured text before it's transformed into another format.

4. Text data types

To declare a column in a table as a text data type, we use the `VARCHAR` keyword. `VARCHAR` takes an optional integer, which represents the maximum number of characters that can be stored in that column. Otherwise, the default number of characters is 16,777,216. In addition to `VARCHAR`, `TEXT`, and `STRING` can also be used to declared a column as text. They are synonymous with `VARCHAR`. The syntax to do this is shown here. By the nature of text data, values can look different column-to-column, and even row-to-row. Check out this table!

5. Describing a Snowflake table

Luckily, Snowflake provides a handy way to better understand the schema of a certain table, called `DESCRIBE TABLE`. `DESCRIBE TABLE` outputs information about each column in a Snowflake table, including the name, type, and a number of other attributes of each column. Here, a `DESCRIBE TABLE` shows the name and type of each column. These columns all contain text data, which we can tell by the `VARCHAR` type they take.

6. Text data in queries

To properly retrieve and filter data, it's common to use text values in a SQL query itself. We'll often find text values in `SELECT` statements, `WHERE` clauses, and `CASE` statements. To do this, we MUST wrap our string value in single quotes. If the value is not in single quotes, Snowflake will throw an error. This now makes our value case-sensitive, meaning each letter will have to match exactly what is within quotes.

7. Manipulating text data

Later, we'll explore different ways to extract information from and transform text data using some of the functions shown here. Take a quick peek, we'll dig more into these soon!

8. Let's practice!

Think you've got it? Well, it's time to take your new skills for a spin with a couple of hands-on exercises. Buckle up!

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.