Help Center/
GaussDB(DWS)/
Tool Guide/
DSC/
SQL Syntax Migration Reference/
MySQL Syntax Migrating/
Data Types/
Binary Types
Updated on 2024-07-19 GMT+08:00
Binary Types
Overview
- In MySQL, the BIT data type is used to store bit values, ranging from 1 to 64.
- MySQL BINARY and VARBINARY types are similar to CHAR and VARCHAR, except that they contain binary strings rather than non-binary strings.
Type Mapping
MySQL Binary Type |
MySQL INPUT |
GaussDB(DWS) OUTPUT |
---|---|---|
BIT[(M)] |
BIT[(M)] |
BIT[(M)] |
BINARY[(M)] |
BINARY[(M)] |
BYTEA |
CHAR BYTE[(M)] |
BINARY[(M)] |
BYTEA |
VARBINARY[(M)] |
VARBINARY[(M)] |
BYTEA |
Input: BIT
1 2 3 4 5 |
CREATE TABLE IF NOT EXISTS `runoob_dataType_test`( `dataType_1` INT, `dataType_2` BIT(1), `dataType_3` BIT(64) ); |
Output
1 2 3 4 5 6 7 8 9 |
CREATE TABLE IF NOT EXISTS "public"."runoob_datatype_test" ( "datatype_1" INTEGER, "datatype_2" BIT(1), "datatype_3" BIT(64) ) WITH ( ORIENTATION = ROW, COMPRESSION = NO ) NOCOMPRESS DISTRIBUTE BY HASH ("datatype_1"); |
Input: [VAR]BINARY
1 2 3 4 5 6 7 8 |
CREATE TABLE IF NOT EXISTS `runoob_dataType_test`( `dataType_1` INT, `dataType_2` BINARY, `dataType_3` BINARY(0), `dataType_4` BINARY(255), `dataType_5` VARBINARY(0), `dataType_6` VARBINARY(6553) ); |
Output
1 2 3 4 5 6 7 8 9 10 11 12 |
CREATE TABLE IF NOT EXISTS "public"."runoob_datatype_test" ( "datatype_1" INTEGER, "datatype_2" BYTEA, "datatype_3" BYTEA, "datatype_4" BYTEA, "datatype_5" BYTEA, "datatype_6" BYTEA ) WITH ( ORIENTATION = ROW, COMPRESSION = NO ) NOCOMPRESS DISTRIBUTE BY HASH ("datatype_1"); |
Parent topic: Data Types
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot