Incorporate Comments 1
Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/477330e1 Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/477330e1 Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/477330e1 Branch: refs/heads/master Commit: 477330e1ee1f261bb973af9c962d2b9208e7316f Parents: b68ab4d Author: liu.yu <[email protected]> Authored: Tue Jul 10 10:40:49 2018 +0800 Committer: liu.yu <[email protected]> Committed: Tue Jul 10 10:40:49 2018 +0800 ---------------------------------------------------------------------- .../_chapters/sql_language_elements.adoc | 43 +++++++++----------- 1 file changed, 20 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafodion/blob/477330e1/docs/sql_reference/src/asciidoc/_chapters/sql_language_elements.adoc ---------------------------------------------------------------------- diff --git a/docs/sql_reference/src/asciidoc/_chapters/sql_language_elements.adoc b/docs/sql_reference/src/asciidoc/_chapters/sql_language_elements.adoc index 43b8b9d..8093145 100644 --- a/docs/sql_reference/src/asciidoc/_chapters/sql_language_elements.adoc +++ b/docs/sql_reference/src/asciidoc/_chapters/sql_language_elements.adoc @@ -324,15 +324,15 @@ The following table summarizes the {project-name} SQL data types: [cols="14%,14%,24%,24%,24%",options="header"] |=== -| Category | Type | SQL Designation | Description | Size or Range^1^ -.8+| Character String Data Type .3+| Fixed-length character | CHAR[ACTER] | Fixed-length character data | 1 to 16,777,216 bytes ^6^ -| NCHAR | Fixed-length character data in predefined national character set | 1 to 16,777,216 bytes^2^ ^5^ ^7^ -| NATIONAL CHAR[ACTER] | Fixed-length character data in predefined national character set | 1 to 16,777,216 bytes^2^ ^5^ ^7^ -.5+| Variable-length character | VARCHAR | Variable-length ASCII character string | 1 to 16,777,216 bytes^3^ ^6^ -| VARCHAR2 | Variable-length ASCII character string | 1 to 16,777,216 bytes^3^ ^6^ -| CHAR[ACTER] VARYING | Variable-length ASCII character string | 1 to 16,777,216 bytes^3^ ^6^ -| NCHAR VARYING | Variable-length ASCII character string | 1 to 16,777,216 bytes^3^ ^5^ ^7^ -| NATIONAL CHAR[ACTER] VARYING | Variable-length ASCII character string | 1 to 16,777,216 bytes^3^ ^5^ ^7^ +^| *Category* ^| *Type* ^| *SQL Designation* ^| *Description* ^| *Size or Range*^1^ +.8+| Character String Data Type .3+| Fixed-length character | CHAR[ACTER] | Fixed-length character data | 1 to 16,777,216 bytes ^2^ +| NCHAR | Fixed-length character data in predefined national character set | 1 to 16,777,216 bytes^2^ ^3^ +| NATIONAL CHAR[ACTER] | Fixed-length character data in predefined national character set | 1 to 16,777,216 bytes^2^ ^3^ +.5+| Variable-length character | VARCHAR | Variable-length ASCII character string | 1 to 16,777,216 bytes^2^ ^4^ +| VARCHAR2 | Variable-length ASCII character string | 1 to 16,777,216 bytes^2^ ^4^ +| CHAR[ACTER] VARYING | Variable-length ASCII character string | 1 to 16,777,216 bytes^2^ ^4^ +| NCHAR VARYING | Variable-length ASCII character string | 1 to 16,777,216 bytes^2^ ^3^ ^4^ +| NATIONAL CHAR[ACTER] VARYING | Variable-length ASCII character string | 1 to 16,777,216 bytes^2^ ^3^ ^4^ .6+| Datetime Data Types .6+| Date-Time | | Point in time, using the Gregorian calendar and a 24 hour clock system. The five supported designations are listed below. | YEAR 0001-9999 + MONTH 1-12 + @@ -360,7 +360,7 @@ FRACTION in 4 bytes + | TIMESTAMP | Point in time, no time precision | Format as YYYY-MM-DD HH:MM:SS.FFFFFF; actual database storage size is 11 bytes | TIMESTAMP (with time precision) | Point in time, with time precision | Format as YYYY-MM-DD HH:MM:SS.FFFFFF; actual database storage size is 1 byte | Interval Data Types |Interval | INTERVAL | Duration of time; value is in the YEAR/MONTH range or the DAY/HOUR/MINUTE/YEAR/SECOND/FRACTION range -| YEAR no constraint^4^ + +| YEAR no constraint^5^ + MONTH 0-11 + DAY no constraint + HOUR 0-23 + @@ -395,23 +395,20 @@ length of 8 bytes. * _scale_ is the number of digits to the right of the decimal. * _precision_ specifies the allowed number of decimal digits. - 1. The size of a column that allows null values is 2 bytes larger than the size for the defined data type. -2. Storage size is the same as that required by CHAR data type but store only half. -3. Storage size is reduced by 4 bytes for storage of the varying character length field. -4. The maximum number of digits in an INTERVAL value is 18, including the digits in all INTERVAL fields of the value. -Any INTERVAL field that is a starting field can have up to 18 digits minus the number of other digits in the INTERVAL value. -5. The maximum is 16,777,216 bytes whether the national character set was specified at installation time to be ISO88591 or UTF8. -6. The number of characters varies depending on the character set. +2. The maximum number of characters depends on the character set. + -[cols="2*^",options="header"] +[cols="2*",options="header"] |=== -| *Character Set* | *Character* -| ISO88581 | 16,777,216, which is divided 16,777,216 by 1 -| UCS2 | 8,388,608, which is divided 16,777,216 by 2 -| UTF8 | 4,194,304, which is divided 16,777,216 by 4 +^| *Character Set* ^| *Maximum Number of Characters* +| For 8-bit character sets such as *ISO88591* | Equal to the maximum storage size in bytes, that is 16,777,216, which is divided 16,777,216 by 1 +| For 16-bit character sets such as *UCS2* | Half the maximum storage size in bytes, that is 8,388,608, which is divided 16,777,216 by 2 +| For 32-bit character sets such as *UTF8* | One fourth the maximum storage size in bytes, that is 4,194,304, which is divided 16,777,216 by 4 |=== -7. The number of characters is 8,388,608 (UCS2). +3. NCHAR or NATIONAL CHAR implicitly assumes that the character set is UCS2, whether the character set was specified at installation time to be ISO88591 or UTF8, and the character set (UCS2) cannot be specified or altered. This is true for both CREATE and ALTER statement. +4. Storage size is reduced by 4 bytes for storage of the varying character length field. +5. The maximum number of digits in an INTERVAL value is 18, including the digits in all INTERVAL fields of the value. +Any INTERVAL field that is a starting field can have up to 18 digits minus the number of other digits in the INTERVAL value. <<< [[comparable_and_compatible_data_types]]
