VARCHAR
Store variable-length text strings with VARCHAR columns in Datasquirel.Overview
VARCHAR(n) stores variable-length strings up to n characters. It is the most commonly used text type for short strings like names, email addresses, slugs, and status values.
Syntax
VARCHAR(255)
The number in parentheses is the maximum length in characters. Common values are:
VARCHAR(100)— short names, slugs, categoriesVARCHAR(255)— email addresses, URLs, titlesVARCHAR(1000)— longer descriptions (though TEXT is often more appropriate)
The maximum allowed length is 65,535 characters, though in practice anything over a few hundred characters is better stored as TEXT.
When to Use VARCHAR
Use VARCHAR when:
- The value is a short string with a predictable maximum length
- You plan to index the column (VARCHAR columns are faster to index than TEXT)
- The value is used in
WHEREclauses,ORDER BY, orJOINconditions
Use TEXT instead when:
- The value can be arbitrarily long (descriptions, comments, content)
- You do not need to index the full value
In Datasquirel
When adding a field to a table, select VARCHAR as the data type and enter the maximum length. If no length is specified, Datasquirel defaults to VARCHAR(255).


Notes
- VARCHAR is case-insensitive in comparisons by default (controlled by the column collation).
- Leading and trailing spaces are preserved in VARCHAR values.
- An empty string
""is a valid VARCHAR value and is distinct from NULL.