Text type

  • VARCHAR.

    • Aliases: CHAR, BPCHAR, STRING, TEXT

Description

The VARCHAR type is used to store text strings. This type allows storing characters Unicode. The data is encoded in the format UTF-8.

To specify the value of a text string in the expression INSERT, use single quotes.

Example

Create a varchar_table table and fill two cells with text strings:

CREATE TABLE varchar_table(text_column VARCHAR);

INSERT INTO varchar_table VALUES
    ('My name is Tengri'),
    ('My nickname is TNGRi');

SELECT * FROM varchar_table;
+----------------------+
|      text_column     |
+----------------------+
| My name is Tengri    |
+----------------------+
| My nickname is TNGRi |
+----------------------+

Note that in programme output, text strings are displayed without inverted commas.