Loading section...

String Data Type

A string is a data type that holds text. Strings are enclosed in single quotes in SQL. The text inside can contain letters, numbers, spaces, punctuation, or special characters. A string could be as short as one character or as long as several megabytes of text. When you see values like 'Alice', 'alice@email.com', or 'San Francisco' in a database, those are strings. The single quotes tell the database "this is text, not a keyword or number." Before manipulating strings, it helps to understand how SQL represents and stores them. The following sections cover the basics of string syntax and type distinctions. String Literals in SQL You can use string literals directly in your queries by wrapping them in single quotes: The text 'Hello World' is a string literal. SQL treats it as a fixed text va