# 使用其他数据库引擎中的数据类型

为了便于使用为其他供应商的 SQL 实现编写的代码，MySQL 映射了数据类型，如下表所示。这些映射使得从其他数据库系统导入表定义到 MySQL 变得更加简单。

| Other Vendor Type    | MySQL Type |
| -------------------- | ---------- |
| BOOL                 | TINYINT    |
| BOOLEAN              | TINYINT    |
| CHARACTER VARYING(M) | VARCHAR(M) |
| FIXED                | DECIMAL    |
| FLOAT4               | FLOAT      |
| FLOAT8               | BOUBLE     |
| INT1                 | TINYINT    |
| INT2                 | SMALLINT   |
| INT3                 | MEDIUMINT  |
| INT4                 | INT        |
| INT8                 | BIGINT     |
| LONG VARBINARY       | MEDIUMBLOB |
| LONG VARCHAR         | MEDIUMTEXT |
| LONG                 | MEDIUMTEXT |
| MIDDLEINT            | MEDIUMINT  |
| NUMERIC              | DECIMAL    |

数据类型映射在创建表时发生，此后原始类型就会失效。如果使用其他供应商的类型创建表，然后执行 DESCRIBE tbl\_name 语句，MySQL 会使用等效的 MySQL 类型报告表的结构。例如：

```bash
mysql> CREATE TABLE t (a BOOL, b FLOAT8, c LONG VARCHAR, d NUMERIC);
Query OK, 0 rows affected (0.00 sec)

mysql> DESCRIBE t;
+-------+---------------+------+-----+---------+-------+
| Field | Type          | Null | Key | Default | Extra |
+-------+---------------+------+-----+---------+-------+
| a     | tinyint(1)    | YES  |     | NULL    |       |
| b     | double        | YES  |     | NULL    |       |
| c     | mediumtext    | YES  |     | NULL    |       |
| d     | decimal(10,0) | YES  |     | NULL    |       |
+-------+---------------+------+-----+---------+-------+
4 rows in set (0.01 sec)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jchehe.gitbook.io/mysql_data_types_cn/shi-yong-qi-ta-shu-ju-ku-yin-qing-zhong-de-shu-ju-lei-xing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
