Character String Types

Use character string data types to represent text. A character string, or just string, has these characteristics:

  • It’s an ordered sequence of zero or more characters.

  • Its length can be fixed or varying.

  • It’s case-sensitive ('A' comes before 'a' when sorted).

  • In SQL statements, a string literal is surrounded by single quotes.

  • It’s one of the types listed in Table 3.5.

Table 3.5. Character String Types
TYPEDESCRIPTION
CHARACTERRepresents a fixed number of characters. A string stored in a column defined as CHARACTER(length) can have up to length characters, where length is a number (integer) greater than or equal to 1; the maximum length depends on the DBMS. When you store a string with fewer than length characters in a CHARACTER( ...

Get SQL: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.