diff --git a/auto-increment.md b/auto-increment.md index 37fc43cc6bcc..c5250a9dc6af 100644 --- a/auto-increment.md +++ b/auto-increment.md @@ -302,7 +302,7 @@ SHOW CREATE TABLE t; | Table | Create Table | +-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | t | CREATE TABLE `t` ( - `a` int(11) NOT NULL AUTO_INCREMENT, + `a` int NOT NULL AUTO_INCREMENT, PRIMARY KEY (`a`) /*T![clustered_index] CLUSTERED */ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=101 /*T![auto_id_cache] AUTO_ID_CACHE=100 */ | +-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ diff --git a/auto-random.md b/auto-random.md index 034e06e41c80..14995980c9fa 100644 --- a/auto-random.md +++ b/auto-random.md @@ -78,7 +78,7 @@ tidb> SHOW CREATE TABLE t; | Table | Create Table | +-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | t | CREATE TABLE `t` ( - `a` bigint(20) NOT NULL /*T![auto_rand] AUTO_RANDOM(5) */, + `a` bigint NOT NULL /*T![auto_rand] AUTO_RANDOM(5) */, `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) /*T![clustered_index] CLUSTERED */ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin /*T! PRE_SPLIT_REGIONS=2 */ | diff --git a/basic-sql-operations.md b/basic-sql-operations.md index 869de07f0367..f0e6cf4396b6 100644 --- a/basic-sql-operations.md +++ b/basic-sql-operations.md @@ -94,7 +94,7 @@ CREATE TABLE table_name column_name data_type constraint; ```sql CREATE TABLE person ( - id INT(11), + id int, name VARCHAR(255), birthday DATE ); diff --git a/cached-tables.md b/cached-tables.md index f46972248707..5d9d88abbdf9 100644 --- a/cached-tables.md +++ b/cached-tables.md @@ -64,7 +64,7 @@ SHOW CREATE TABLE users; | Table | Create Table | +-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | users | CREATE TABLE `users` ( - `id` bigint(20) NOT NULL, + `id` bigint NOT NULL, `name` varchar(100) DEFAULT NULL, PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin /* CACHED ON */ | @@ -170,10 +170,10 @@ SHOW CREATE TABLE mysql.table_cache_meta\G *************************** 1. row *************************** Table: table_cache_meta Create Table: CREATE TABLE `table_cache_meta` ( - `tid` bigint(11) NOT NULL DEFAULT '0', + `tid` bigint NOT NULL DEFAULT '0', `lock_type` enum('NONE','READ','INTEND','WRITE') NOT NULL DEFAULT 'NONE', - `lease` bigint(20) NOT NULL DEFAULT '0', - `oldReadLease` bigint(20) NOT NULL DEFAULT '0', + `lease` bigint NOT NULL DEFAULT '0', + `oldReadLease` bigint NOT NULL DEFAULT '0', PRIMARY KEY (`tid`) /*T![clustered_index] CLUSTERED */ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin 1 row in set (0.00 sec) diff --git a/clustered-indexes.md b/clustered-indexes.md index bbd928f30661..a48325ae9fb9 100644 --- a/clustered-indexes.md +++ b/clustered-indexes.md @@ -104,7 +104,7 @@ mysql> SHOW CREATE TABLE t; | Table | Create Table | +-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | t | CREATE TABLE `t` ( - `a` bigint(20) NOT NULL, + `a` bigint NOT NULL, `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) /*T![clustered_index] CLUSTERED */ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin | diff --git a/constraints.md b/constraints.md index 70e04cfbb75f..fc8dffa7885e 100644 --- a/constraints.md +++ b/constraints.md @@ -101,9 +101,9 @@ SHOW CREATE TABLE t; | Table | Create Table | +-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | t | CREATE TABLE `t` ( - `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT NULL, + `a` int DEFAULT NULL, + `b` int DEFAULT NULL, + `c` int DEFAULT NULL, CONSTRAINT `c1` CHECK ((`b` > `c`)), CONSTRAINT `t_chk_1` CHECK ((`a` > 10)) /*!80016 NOT ENFORCED */, CONSTRAINT `t_chk_2` CHECK ((1 < `c`)) diff --git a/cost-model.md b/cost-model.md index 984d85e9e704..348967314c17 100644 --- a/cost-model.md +++ b/cost-model.md @@ -19,9 +19,9 @@ mysql> SHOW CREATE TABLE t; | Table | Create Table | +-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | t | CREATE TABLE `t` ( - `a` int(11) DEFAULT NULL, - `b` int(11) DEFAULT NULL, - `c` int(11) DEFAULT NULL, + `a` int DEFAULT NULL, + `b` int DEFAULT NULL, + `c` int DEFAULT NULL, KEY `b` (`b`), KEY `c` (`c`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin | diff --git a/develop/dev-guide-bookshop-schema-design.md b/develop/dev-guide-bookshop-schema-design.md index 473854df96cf..4f4001915cbf 100644 --- a/develop/dev-guide-bookshop-schema-design.md +++ b/develop/dev-guide-bookshop-schema-design.md @@ -135,10 +135,10 @@ WHERE table_schema LIKE 'bookshop'; | 字段名 | 类型 | 含义 | |--------------|---------------|---------------------------------------| -| id | bigint(20) | 书籍的唯一标识 | +| id | bigint | 书籍的唯一标识 | | title | varchar(100) | 书籍名称 | | type | enum | 书籍类型(如:杂志、动漫、教辅等) | -| stock | bigint(20) | 库存 | +| stock | bigint | 库存 | | price | decimal(15,2) | 价格 | | published_at | datetime | 出版时间 | @@ -148,11 +148,11 @@ WHERE table_schema LIKE 'bookshop'; | 字段名 | 类型 | 含义 | |------------|--------------|-------------------------------------| -| id | bigint(20) | 作者的唯一标识 | +| id | bigint | 作者的唯一标识 | | name | varchar(100) | 姓名 | -| gender | tinyint(1) | 生理性别 (0: 女, 1: 男,NULL: 未知) | -| birth_year | smallint(6) | 生年 | -| death_year | smallint(6) | 卒年 | +| gender | tinyint | 生理性别 (0: 女, 1: 男,NULL: 未知) | +| birth_year | smallint | 生年 | +| death_year | smallint | 卒年 | ### `users` 表 @@ -160,7 +160,7 @@ WHERE table_schema LIKE 'bookshop'; | 字段名 | 类型 | 含义 | |----------|---------------|----------------| -| id | bigint(20) | 用户的唯一标识 | +| id | bigint | 用户的唯一标识 | | balance | decimal(15,2) | 余额 | | nickname | varchar(100) | 昵称 | @@ -181,8 +181,8 @@ WHERE table_schema LIKE 'bookshop'; | 字段名 | 类型 | 含义 | |-----------|------------|--------------------------------------------| -| book_id | bigint(20) | 书籍的唯一标识(关联至 [books](#books-表)) | -| author_id | bigint(20) | 作者的唯一标识(关联至 [authors](#authors-表)) | +| book_id | bigint | 书籍的唯一标识(关联至 [books](#books-表)) | +| author_id | bigint | 作者的唯一标识(关联至 [authors](#authors-表)) | ### `orders` 表 @@ -190,10 +190,10 @@ WHERE table_schema LIKE 'bookshop'; | 字段名 | 类型 | 含义 | |------------|------------|--------------------------------------------| -| id | bigint(20) | 订单的唯一标识 | -| book_id | bigint(20) | 书籍的唯一标识(关联至 [books](#books-表)) | -| user_id | bigint(20) | 用户唯一标识(关联至 [users](#users-表)) | -| quantity | tinyint(4) | 购买数量 | +| id | bigint | 订单的唯一标识 | +| book_id | bigint | 书籍的唯一标识(关联至 [books](#books-表)) | +| user_id | bigint | 用户唯一标识(关联至 [users](#users-表)) | +| quantity | tinyint | 购买数量 | | ordered_at | datetime | 购买时间 | ## 数据库初始化 `dbinit.sql` 脚本 @@ -205,29 +205,29 @@ CREATE DATABASE IF NOT EXISTS `bookshop`; DROP TABLE IF EXISTS `bookshop`.`books`; CREATE TABLE `bookshop`.`books` ( - `id` bigint(20) AUTO_RANDOM NOT NULL, + `id` bigint AUTO_RANDOM NOT NULL, `title` varchar(100) NOT NULL, `type` enum('Magazine', 'Novel', 'Life', 'Arts', 'Comics', 'Education & Reference', 'Humanities & Social Sciences', 'Science & Technology', 'Kids', 'Sports') NOT NULL, `published_at` datetime NOT NULL, - `stock` int(11) DEFAULT '0', + `stock` int DEFAULT '0', `price` decimal(15,2) DEFAULT '0.0', PRIMARY KEY (`id`) CLUSTERED ) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; DROP TABLE IF EXISTS `bookshop`.`authors`; CREATE TABLE `bookshop`.`authors` ( - `id` bigint(20) AUTO_RANDOM NOT NULL, + `id` bigint AUTO_RANDOM NOT NULL, `name` varchar(100) NOT NULL, - `gender` tinyint(1) DEFAULT NULL, - `birth_year` smallint(6) DEFAULT NULL, - `death_year` smallint(6) DEFAULT NULL, + `gender` tinyint DEFAULT NULL, + `birth_year` smallint DEFAULT NULL, + `death_year` smallint DEFAULT NULL, PRIMARY KEY (`id`) CLUSTERED ) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; DROP TABLE IF EXISTS `bookshop`.`book_authors`; CREATE TABLE `bookshop`.`book_authors` ( - `book_id` bigint(20) NOT NULL, - `author_id` bigint(20) NOT NULL, + `book_id` bigint NOT NULL, + `author_id` bigint NOT NULL, PRIMARY KEY (`book_id`,`author_id`) CLUSTERED ) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; @@ -252,10 +252,10 @@ CREATE TABLE `bookshop`.`users` ( DROP TABLE IF EXISTS `bookshop`.`orders`; CREATE TABLE `bookshop`.`orders` ( - `id` bigint(20) AUTO_RANDOM NOT NULL, - `book_id` bigint(20) NOT NULL, - `user_id` bigint(20) NOT NULL, - `quality` tinyint(4) NOT NULL, + `id` bigint AUTO_RANDOM NOT NULL, + `book_id` bigint NOT NULL, + `user_id` bigint NOT NULL, + `quality` tinyint NOT NULL, `ordered_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) CLUSTERED, KEY `orders_book_id_idx` (`book_id`) diff --git a/develop/dev-guide-create-secondary-indexes.md b/develop/dev-guide-create-secondary-indexes.md index f8053b3dfb88..729c87527644 100644 --- a/develop/dev-guide-create-secondary-indexes.md +++ b/develop/dev-guide-create-secondary-indexes.md @@ -58,20 +58,20 @@ KEY `{index_name}` (`{column_names}`) | 字段名 | 类型 | 含义 | | :----------: | :-----------: | :-----------------------------------: | -| id | bigint(20) | 书籍的唯一标识 | +| id | bigint | 书籍的唯一标识 | | title | varchar(100) | 书籍名称 | | type | enum | 书籍类型(如:杂志、动漫、教辅等) | -| stock | bigint(20) | 库存 | +| stock | bigint | 库存 | | price | decimal(15,2) | 价格 | | published_at | datetime | 出版时间 | ```sql CREATE TABLE `bookshop`.`books` ( - `id` bigint(20) AUTO_RANDOM NOT NULL, + `id` bigint AUTO_RANDOM NOT NULL, `title` varchar(100) NOT NULL, `type` enum('Magazine', 'Novel', 'Life', 'Arts', 'Comics', 'Education & Reference', 'Humanities & Social Sciences', 'Science & Technology', 'Kids', 'Sports') NOT NULL, `published_at` datetime NOT NULL, - `stock` int(11) DEFAULT '0', + `stock` int DEFAULT '0', `price` decimal(15,2) DEFAULT '0.0', PRIMARY KEY (`id`) CLUSTERED ) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; diff --git a/develop/dev-guide-index-best-practice.md b/develop/dev-guide-index-best-practice.md index 2bfb1a96982b..b4f781a35752 100644 --- a/develop/dev-guide-index-best-practice.md +++ b/develop/dev-guide-index-best-practice.md @@ -16,11 +16,11 @@ aliases: ['/zh/tidb/dev/index-best-practice'] ```sql CREATE TABLE `books` ( - `id` bigint(20) AUTO_RANDOM NOT NULL, + `id` bigint AUTO_RANDOM NOT NULL, `title` varchar(100) NOT NULL, `type` enum('Magazine', 'Novel', 'Life', 'Arts', 'Comics', 'Education & Reference', 'Humanities & Social Sciences', 'Science & Technology', 'Kids', 'Sports') NOT NULL, `published_at` datetime NOT NULL, - `stock` int(11) DEFAULT '0', + `stock` int DEFAULT '0', `price` decimal(15,2) DEFAULT '0.0', PRIMARY KEY (`id`) CLUSTERED ) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; diff --git a/develop/dev-guide-transaction-restraints.md b/develop/dev-guide-transaction-restraints.md index f9ffccc0401c..63746f14ab42 100644 --- a/develop/dev-guide-transaction-restraints.md +++ b/develop/dev-guide-transaction-restraints.md @@ -84,10 +84,10 @@ public class EffectWriteSkew { public static void createDoctorTable(Connection connection) throws SQLException { connection.createStatement().executeUpdate("CREATE TABLE `doctors` (" + - " `id` int(11) NOT NULL," + + " `id` int NOT NULL," + " `name` varchar(255) DEFAULT NULL," + - " `on_call` tinyint(1) DEFAULT NULL," + - " `shift_id` int(11) DEFAULT NULL," + + " `on_call` tinyint DEFAULT NULL," + + " `shift_id` int DEFAULT NULL," + " PRIMARY KEY (`id`)," + " KEY `idx_shift_id` (`shift_id`)" + " ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin"); @@ -308,10 +308,10 @@ func prepareData(db *sql.DB) error { func createDoctorTable(db *sql.DB) error { _, err := db.Exec("CREATE TABLE IF NOT EXISTS `doctors` (" + - " `id` int(11) NOT NULL," + + " `id` int NOT NULL," + " `name` varchar(255) DEFAULT NULL," + - " `on_call` tinyint(1) DEFAULT NULL," + - " `shift_id` int(11) DEFAULT NULL," + + " `on_call` tinyint DEFAULT NULL," + + " `shift_id` int DEFAULT NULL," + " PRIMARY KEY (`id`)," + " KEY `idx_shift_id` (`shift_id`)" + " ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin") @@ -413,10 +413,10 @@ public class EffectWriteSkew { public static void createDoctorTable(Connection connection) throws SQLException { connection.createStatement().executeUpdate("CREATE TABLE `doctors` (" + - " `id` int(11) NOT NULL," + + " `id` int NOT NULL," + " `name` varchar(255) DEFAULT NULL," + - " `on_call` tinyint(1) DEFAULT NULL," + - " `shift_id` int(11) DEFAULT NULL," + + " `on_call` tinyint DEFAULT NULL," + + " `shift_id` int DEFAULT NULL," + " PRIMARY KEY (`id`)," + " KEY `idx_shift_id` (`shift_id`)" + " ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin"); @@ -637,10 +637,10 @@ func prepareData(db *sql.DB) error { func createDoctorTable(db *sql.DB) error { _, err := db.Exec("CREATE TABLE IF NOT EXISTS `doctors` (" + - " `id` int(11) NOT NULL," + + " `id` int NOT NULL," + " `name` varchar(255) DEFAULT NULL," + - " `on_call` tinyint(1) DEFAULT NULL," + - " `shift_id` int(11) DEFAULT NULL," + + " `on_call` tinyint DEFAULT NULL," + + " `shift_id` int DEFAULT NULL," + " PRIMARY KEY (`id`)," + " KEY `idx_shift_id` (`shift_id`)" + " ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin") diff --git a/develop/dev-guide-unique-serial-number-generation.md b/develop/dev-guide-unique-serial-number-generation.md index 77bd5b3449a7..0227d26b8eab 100644 --- a/develop/dev-guide-unique-serial-number-generation.md +++ b/develop/dev-guide-unique-serial-number-generation.md @@ -40,8 +40,8 @@ uid-generator 生成的 64 位 ID 结构如下: | 字段名 | 字段类型 | 字段说明 | | -------- | ------------ | ---------------------------- | | SEQ_NAME | varchar(128) | 序列名称,用来区分不同业务 | -| MAX_ID | bigint(20) | 当前序列已被分配出去的最大值 | -| STEP | int(11) | 步长,表示每次分配的号段长度 | +| MAX_ID | bigint | 当前序列已被分配出去的最大值 | +| STEP | int | 步长,表示每次分配的号段长度 | 应用程序每次按配置好的步长获取一段序列号,并同时更新数据库以持久化保存当前序列已被分配出去的最大值,然后在应用程序内存中即可完成序列号加工及分配动作。待一段号码耗尽之后,应用程序才会去获取新的号段,这样就有效降低了数据库写入压力。实际使用过程中,还可以适度调节步长以控制数据库记录的更新频度。 diff --git a/dm/dm-manage-schema.md b/dm/dm-manage-schema.md index 5a18ce13e6bf..16ced8d12e86 100644 --- a/dm/dm-manage-schema.md +++ b/dm/dm-manage-schema.md @@ -122,7 +122,7 @@ binlog-schema list -s mysql-replica-01 task_single db_single t1 "sources": [ { "result": true, - "msg": "CREATE TABLE `t1` ( `c1` int(11) NOT NULL, `c2` int(11) DEFAULT NULL, PRIMARY KEY (`c1`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin", + "msg": "CREATE TABLE `t1` ( `c1` int NOT NULL, `c2` int DEFAULT NULL, PRIMARY KEY (`c1`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin", "source": "mysql-replica-01", "worker": "127.0.0.1:8262" } @@ -159,8 +159,8 @@ Global Flags: ```sql CREATE TABLE `t1` ( - `c1` int(11) NOT NULL, - `c2` bigint(11) DEFAULT NULL, + `c1` int NOT NULL, + `c2` bigint DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin ``` diff --git a/dm/dm-open-api.md b/dm/dm-open-api.md index 1198b7011d17..1eb5fe147178 100644 --- a/dm/dm-open-api.md +++ b/dm/dm-open-api.md @@ -1615,7 +1615,7 @@ curl -X 'GET' \ { "schema_name": "db1", "table_name": "table1", - "schema_create_sql": "CREATE TABLE `t1` (`id` int(11) NOT NULL AUTO_INCREMENT,PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin" + "schema_create_sql": "CREATE TABLE `t1` (`id` int NOT NULL AUTO_INCREMENT,PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin" } ``` @@ -1637,7 +1637,7 @@ curl -X 'PUT' \ -H 'accept: */*' \ -H 'Content-Type: application/json' \ -d '{ - "sql_content": "CREATE TABLE `t1` ( `c1` int(11) DEFAULT NULL, `c2` int(11) DEFAULT NULL, `c3` int(11) DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;", + "sql_content": "CREATE TABLE `t1` ( `c1` int DEFAULT NULL, `c2` int DEFAULT NULL, `c3` int DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;", "flush": true, "sync": true }' diff --git a/dm/dm-performance-test.md b/dm/dm-performance-test.md index e1fa39d43307..a6463904b84f 100644 --- a/dm/dm-performance-test.md +++ b/dm/dm-performance-test.md @@ -28,8 +28,8 @@ aliases: ['/docs-cn/tidb-data-migration/dev/performance-test/'] ```sql CREATE TABLE `sbtest` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `k` int(11) NOT NULL DEFAULT '0', + `id` int NOT NULL AUTO_INCREMENT, + `k` int NOT NULL DEFAULT '0', `c` char(120) CHARSET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '', `pad` char(60) CHARSET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '', PRIMARY KEY (`id`), diff --git a/dm/dm-table-routing.md b/dm/dm-table-routing.md index 66380eecba70..e2e84d173a85 100644 --- a/dm/dm-table-routing.md +++ b/dm/dm-table-routing.md @@ -112,7 +112,7 @@ routes: ```sql CREATE TABLE `test`.`t` ( - a int(11) PRIMARY KEY, + a int PRIMARY KEY, c_table varchar(10) DEFAULT NULL, c_schema varchar(10) DEFAULT NULL, c_source varchar(10) DEFAULT NULL @@ -180,7 +180,7 @@ mysql> select * from test.t; ```sql CREATE TABLE `test`.`t` ( c_table varchar(10) DEFAULT NULL, - a int(11) PRIMARY KEY, + a int PRIMARY KEY, c_schema varchar(10) DEFAULT NULL, c_source varchar(10) DEFAULT NULL ); @@ -190,7 +190,7 @@ CREATE TABLE `test`.`t` ( ```sql CREATE TABLE `test`.`t` ( - a int(11) PRIMARY KEY, + a int PRIMARY KEY, c_table varchar(10) DEFAULT NULL, c_schema varchar(10) DEFAULT NULL, ); @@ -200,9 +200,9 @@ CREATE TABLE `test`.`t` ( ```sql CREATE TABLE `test`.`t` ( - a int(11) PRIMARY KEY, + a int PRIMARY KEY, c_table varchar(10) DEFAULT NULL, - c_schema int(11) DEFAULT NULL, + c_schema int DEFAULT NULL, c_source varchar(10) DEFAULT NULL, ); ``` diff --git a/dm/feature-online-ddl.md b/dm/feature-online-ddl.md index 6f88a5c057b6..4b10969d4192 100644 --- a/dm/feature-online-ddl.md +++ b/dm/feature-online-ddl.md @@ -128,8 +128,8 @@ pt-osc 主要涉及的 SQL 以及 DM 的处理: 1. 创建 `_new` 表: ```sql - CREATE TABLE `test`.`_test4_new` (id int(11) NOT NULL AUTO_INCREMENT, - date date DEFAULT NULL, account_id bigint(20) DEFAULT NULL, conversion_price decimal(20,3) DEFAULT NULL, ocpc_matched_conversions bigint(20) DEFAULT NULL, ad_cost decimal(20,3) DEFAULT NULL,cl2 varchar(20) COLLATE utf8mb4_bin NOT NULL,cl1 varchar(20) COLLATE utf8mb4_bin NOT NULL,PRIMARY KEY (id) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ; + CREATE TABLE `test`.`_test4_new` (id int NOT NULL AUTO_INCREMENT, + date date DEFAULT NULL, account_id bigint DEFAULT NULL, conversion_price decimal(20,3) DEFAULT NULL, ocpc_matched_conversions bigint DEFAULT NULL, ad_cost decimal(20,3) DEFAULT NULL,cl2 varchar(20) COLLATE utf8mb4_bin NOT NULL,cl1 varchar(20) COLLATE utf8mb4_bin NOT NULL,PRIMARY KEY (id) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ; ``` DM: 不执行 `_test4_new` 的创建操作。根据 ghost_schema、ghost_table 以及 dm_worker 的 `server_id`,删除下游 `dm_meta.{task_name}_onlineddl` 的记录,清理内存中的相关信息。 diff --git a/dm/handle-failed-ddl-statements.md b/dm/handle-failed-ddl-statements.md index ca7a02c6682d..6b6dac7f90ab 100644 --- a/dm/handle-failed-ddl-statements.md +++ b/dm/handle-failed-ddl-statements.md @@ -126,7 +126,7 @@ SHOW CREATE TABLE db1.tbl1; | Table | Create Table | +-------+--------------------------------------------------+ | tbl1 | CREATE TABLE `tbl1` ( - `c1` int(11) NOT NULL, + `c1` int NOT NULL, `c2` decimal(11,3) DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 | @@ -249,7 +249,7 @@ SHOW CREATE TABLE shard_db.shard_table; | Table | Create Table | +-------+-----------------------------------------------------------------------------------------------------------+ | tb | CREATE TABLE `shard_table` ( - `id` int(11) DEFAULT NULL, + `id` int DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin | +-------+-----------------------------------------------------------------------------------------------------------+ @@ -483,7 +483,7 @@ SHOW CREATE TABLE db1.tbl1; | Table | Create Table | +-------+-----------------------------------------------------------------------------------------------------------+ | tb | CREATE TABLE `tbl1` ( - `id` int(11) DEFAULT NULL, + `id` int DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin | +-------+-----------------------------------------------------------------------------------------------------------+ @@ -608,7 +608,7 @@ SHOW CREATE TABLE shard_db.shard_table; | Table | Create Table | +-------+-----------------------------------------------------------------------------------------------------------+ | tb | CREATE TABLE `shard_table` ( - `id` int(11) DEFAULT NULL, + `id` int DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin | +-------+-----------------------------------------------------------------------------------------------------------+ diff --git a/dm/manually-handling-sharding-ddl-locks.md b/dm/manually-handling-sharding-ddl-locks.md index afd6427d5055..453da69466bc 100644 --- a/dm/manually-handling-sharding-ddl-locks.md +++ b/dm/manually-handling-sharding-ddl-locks.md @@ -184,7 +184,7 @@ SHOW CREATE TABLE shard_db_1.shard_table_1; | Table | Create Table | +---------------+------------------------------------------+ | shard_table_1 | CREATE TABLE `shard_table_1` ( - `c1` int(11) NOT NULL, + `c1` int NOT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 | +---------------+------------------------------------------+ @@ -234,7 +234,7 @@ MySQL 及 DM 操作与处理流程如下: "mode": "pessimistic" "owner": "mysql-replica-01", "DDLs": [ - "USE `shard_db`; ALTER TABLE `shard_db`.`shard_table` ADD COLUMN `c2` int(11);" + "USE `shard_db`; ALTER TABLE `shard_db`.`shard_table` ADD COLUMN `c2` int;" ], "synced": [ "mysql-replica-01" @@ -297,8 +297,8 @@ MySQL 及 DM 操作与处理流程如下: | Table | Create Table | +-------------+--------------------------------------------------+ | shard_table | CREATE TABLE `shard_table` ( - `c1` int(11) NOT NULL, - `c2` int(11) DEFAULT NULL, + `c1` int NOT NULL, + `c2` int DEFAULT NULL, PRIMARY KEY (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin | +-------------+--------------------------------------------------+ @@ -366,7 +366,7 @@ MySQL 及 DM 操作与处理流程如下: "mode": "pessimistic" "owner": "mysql-replica-02", "DDLs": [ - "USE `shard_db`; ALTER TABLE `shard_db`.`shard_table` ADD COLUMN `c2` int(11);" + "USE `shard_db`; ALTER TABLE `shard_db`.`shard_table` ADD COLUMN `c2` int;" ], "synced": [ "mysql-replica-02" diff --git a/dm/shard-merge-best-practices.md b/dm/shard-merge-best-practices.md index fdfdb0175a4c..1240387b8e91 100644 --- a/dm/shard-merge-best-practices.md +++ b/dm/shard-merge-best-practices.md @@ -42,8 +42,8 @@ aliases: ['/docs-cn/tidb-data-migration/dev/shard-merge-best-practices/'] ```sql CREATE TABLE `tbl_no_pk` ( - `auto_pk_c1` bigint(20) NOT NULL, - `uk_c2` bigint(20) NOT NULL, + `auto_pk_c1` bigint NOT NULL, + `uk_c2` bigint NOT NULL, `content_c3` text, PRIMARY KEY (`auto_pk_c1`), UNIQUE KEY `uk_c2` (`uk_c2`) @@ -61,8 +61,8 @@ CREATE TABLE `tbl_no_pk` ( ```sql CREATE TABLE `tbl_no_pk_2` ( - `auto_pk_c1` bigint(20) NOT NULL, - `uk_c2` bigint(20) NOT NULL, + `auto_pk_c1` bigint NOT NULL, + `uk_c2` bigint NOT NULL, `content_c3` text, INDEX (`auto_pk_c1`), UNIQUE KEY `uk_c2` (`uk_c2`) @@ -85,8 +85,8 @@ CREATE TABLE `tbl_no_pk` ( ```sql CREATE TABLE `tbl_multi_pk` ( - `auto_pk_c1` bigint(20) NOT NULL, - `uuid_c2` bigint(20) NOT NULL, + `auto_pk_c1` bigint NOT NULL, + `uuid_c2` bigint NOT NULL, `content_c3` text, PRIMARY KEY (`auto_pk_c1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 @@ -104,8 +104,8 @@ CREATE TABLE `tbl_multi_pk` ( ```sql CREATE TABLE `tbl_multi_pk_c2` ( - `auto_pk_c1` bigint(20) NOT NULL, - `uuid_c2` bigint(20) NOT NULL, + `auto_pk_c1` bigint NOT NULL, + `uuid_c2` bigint NOT NULL, `content_c3` text, PRIMARY KEY (`auto_pk_c1`,`uuid_c2`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 diff --git a/dumpling-overview.md b/dumpling-overview.md index d1eb204b0d87..f4ba4a2f4057 100644 --- a/dumpling-overview.md +++ b/dumpling-overview.md @@ -170,7 +170,7 @@ tiup dumpling -u root -P 4000 -h 127.0.0.1 -o /tmp/test --filetype csv --sql 'se ```shell CREATE TABLE `t1` ( - `id` int(11) DEFAULT NULL + `id` int DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; ``` diff --git a/explain-walkthrough.md b/explain-walkthrough.md index 0d914ba6edea..d2ceeb4bcebb 100644 --- a/explain-walkthrough.md +++ b/explain-walkthrough.md @@ -134,13 +134,13 @@ SHOW CREATE TABLE trips\G *************************** 1. row *************************** Table: trips Create Table: CREATE TABLE `trips` ( - `trip_id` bigint(20) NOT NULL AUTO_INCREMENT, - `duration` int(11) NOT NULL, + `trip_id` bigint NOT NULL AUTO_INCREMENT, + `duration` int NOT NULL, `start_date` datetime DEFAULT NULL, `end_date` datetime DEFAULT NULL, - `start_station_number` int(11) DEFAULT NULL, + `start_station_number` int DEFAULT NULL, `start_station` varchar(255) DEFAULT NULL, - `end_station_number` int(11) DEFAULT NULL, + `end_station_number` int DEFAULT NULL, `end_station` varchar(255) DEFAULT NULL, `bike_number` varchar(255) DEFAULT NULL, `member_type` varchar(255) DEFAULT NULL, diff --git a/foreign-key.md b/foreign-key.md index 1a28b5a6b3d4..40cb0b1cee4b 100644 --- a/foreign-key.md +++ b/foreign-key.md @@ -152,8 +152,8 @@ mysql> SHOW CREATE TABLE child\G *************************** 1. row *************************** Table: child Create Table: CREATE TABLE `child` ( - `id` int(11) DEFAULT NULL, - `pid` int(11) DEFAULT NULL, + `id` int DEFAULT NULL, + `pid` int DEFAULT NULL, KEY `idx_pid` (`pid`), CONSTRAINT `fk_1` FOREIGN KEY (`pid`) REFERENCES `test`.`parent` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin @@ -191,8 +191,8 @@ mysql> SHOW CREATE TABLE child\G *************************** 1. row *************************** Table: child Create Table: CREATE TABLE `child` ( - `id` int(11) DEFAULT NULL, - `pid` int(11) DEFAULT NULL, + `id` int DEFAULT NULL, + `pid` int DEFAULT NULL, KEY `idx_pid` (`pid`), CONSTRAINT `fk_1` FOREIGN KEY (`pid`) REFERENCES `test`.`parent` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin @@ -293,8 +293,8 @@ mysql> SHOW CREATE TABLE child\G ***************************[ 1. row ]*************************** Table | child Create Table | CREATE TABLE `child` ( - `id` int(11) DEFAULT NULL, - `pid` int(11) DEFAULT NULL, + `id` int DEFAULT NULL, + `pid` int DEFAULT NULL, KEY `idx_pid` (`pid`), CONSTRAINT `fk_1` FOREIGN KEY (`pid`) REFERENCES `test`.`parent` (`id`) ON DELETE CASCADE /* FOREIGN KEY INVALID */ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin @@ -335,8 +335,8 @@ SHOW CREATE TABLE child; | Table | Create Table | +-------+-------------------------------------------------------------+ | child | CREATE TABLE `child` ( | -| | `id` int(11) DEFAULT NULL, | -| | `pid` int(11) DEFAULT NULL | +| | `id` int DEFAULT NULL, | +| | `pid` int DEFAULT NULL | | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin | +-------+-------------------------------------------------------------+ ``` diff --git a/functions-and-operators/tidb-functions.md b/functions-and-operators/tidb-functions.md index 0b3510ee339e..6b2a5a78648d 100644 --- a/functions-and-operators/tidb-functions.md +++ b/functions-and-operators/tidb-functions.md @@ -166,7 +166,7 @@ SHOW CREATE TABLE t2\G Table: t2 Create Table: CREATE TABLE `t2` ( `id` binary(36) NOT NULL, - `a` tinyint(3) unsigned NOT NULL, + `a` tinyint unsigned NOT NULL, `v` varchar(512) DEFAULT NULL, PRIMARY KEY (`a`,`id`) /*T![clustered_index] CLUSTERED */ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin diff --git a/migrate-large-mysql-shards-to-tidb.md b/migrate-large-mysql-shards-to-tidb.md index 8369cc3abdae..6362bf3566d7 100644 --- a/migrate-large-mysql-shards-to-tidb.md +++ b/migrate-large-mysql-shards-to-tidb.md @@ -36,9 +36,9 @@ summary: 使用 Dumpling 和 TiDB Lightning 合并导入分表数据到 TiDB, ```sql CREATE TABLE `table1` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `sid` bigint(20) NOT NULL, - `pid` bigint(20) NOT NULL, + `id` bigint NOT NULL AUTO_INCREMENT, + `sid` bigint NOT NULL, + `pid` bigint NOT NULL, `comment` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `sid` (`sid`) @@ -49,9 +49,9 @@ CREATE TABLE `table1` ( ```sql CREATE TABLE `table5` ( - `id` bigint(20) NOT NULL, - `sid` bigint(20) NOT NULL, - `pid` bigint(20) NOT NULL, + `id` bigint NOT NULL, + `sid` bigint NOT NULL, + `pid` bigint NOT NULL, `comment` varchar(255) DEFAULT NULL, INDEX (`id`), UNIQUE KEY `sid` (`sid`) @@ -119,9 +119,9 @@ tiup dumpling -h ${ip} -P 3306 -u root -t 16 -r 200000 -F 256MB -B my_db2 -f 'my ```sql CREATE TABLE `table5` ( - `id` bigint(20) NOT NULL, - `sid` bigint(20) NOT NULL, - `pid` bigint(20) NOT NULL, + `id` bigint NOT NULL, + `sid` bigint NOT NULL, + `pid` bigint NOT NULL, `comment` varchar(255) DEFAULT NULL, INDEX (`id`), UNIQUE KEY `sid` (`sid`) diff --git a/migrate-small-mysql-shards-to-tidb.md b/migrate-small-mysql-shards-to-tidb.md index 65f8b000df07..2502a1725527 100644 --- a/migrate-small-mysql-shards-to-tidb.md +++ b/migrate-small-mysql-shards-to-tidb.md @@ -39,9 +39,9 @@ aliases: ['/zh/tidb/dev/usage-scenario-shard-merge/','/zh/tidb/dev/usage-scenari ```sql CREATE TABLE `sale_01` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `sid` bigint(20) NOT NULL, - `pid` bigint(20) NOT NULL, + `id` bigint NOT NULL AUTO_INCREMENT, + `sid` bigint NOT NULL, + `pid` bigint NOT NULL, `comment` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `sid` (`sid`) @@ -52,9 +52,9 @@ CREATE TABLE `sale_01` ( ```sql CREATE TABLE `sale` ( - `id` bigint(20) NOT NULL, - `sid` bigint(20) NOT NULL, - `pid` bigint(20) NOT NULL, + `id` bigint NOT NULL, + `sid` bigint NOT NULL, + `pid` bigint NOT NULL, `comment` varchar(255) DEFAULT NULL, INDEX (`id`), UNIQUE KEY `sid` (`sid`) diff --git a/migrate-with-more-columns-downstream.md b/migrate-with-more-columns-downstream.md index 23d29a2336a1..8ae131f01a01 100644 --- a/migrate-with-more-columns-downstream.md +++ b/migrate-with-more-columns-downstream.md @@ -36,7 +36,7 @@ DM 同步上游的 binlog 时,会尝试使用下游当前的表结构来解析 ```sql # 上游表结构 CREATE TABLE `messages` ( - `id` int(11) NOT NULL, + `id` int NOT NULL, PRIMARY KEY (`id`) ) ``` @@ -46,7 +46,7 @@ CREATE TABLE `messages` ( ```sql # 下游表结构 CREATE TABLE `messages` ( - `id` int(11) NOT NULL, + `id` int NOT NULL, `message` varchar(255) DEFAULT NULL, # 下游比上游多出的列。 PRIMARY KEY (`id`) ) @@ -61,7 +61,7 @@ CREATE TABLE `messages` ( ```sql # 上游表结构 CREATE TABLE `messages` ( - `id` int(11) NOT NULL, + `id` int NOT NULL, PRIMARY KEY (`id`) ) ``` diff --git a/mysql-schema/mysql-schema-user.md b/mysql-schema/mysql-schema-user.md index 53d290963129..01a563bba33b 100644 --- a/mysql-schema/mysql-schema-user.md +++ b/mysql-schema/mysql-schema-user.md @@ -16,54 +16,54 @@ DESC mysql.user; 输出结果如下: ``` -+------------------------+----------------------+------+------+-------------------+-------+ -| Field | Type | Null | Key | Default | Extra | -+------------------------+----------------------+------+------+-------------------+-------+ -| Host | char(255) | NO | PRI | NULL | | -| User | char(32) | NO | PRI | NULL | | -| authentication_string | text | YES | | NULL | | -| plugin | char(64) | YES | | NULL | | -| Select_priv | enum('N','Y') | NO | | N | | -| Insert_priv | enum('N','Y') | NO | | N | | -| Update_priv | enum('N','Y') | NO | | N | | -| Delete_priv | enum('N','Y') | NO | | N | | -| Create_priv | enum('N','Y') | NO | | N | | -| Drop_priv | enum('N','Y') | NO | | N | | -| Process_priv | enum('N','Y') | NO | | N | | -| Grant_priv | enum('N','Y') | NO | | N | | -| References_priv | enum('N','Y') | NO | | N | | -| Alter_priv | enum('N','Y') | NO | | N | | -| Show_db_priv | enum('N','Y') | NO | | N | | -| Super_priv | enum('N','Y') | NO | | N | | -| Create_tmp_table_priv | enum('N','Y') | NO | | N | | -| Lock_tables_priv | enum('N','Y') | NO | | N | | -| Execute_priv | enum('N','Y') | NO | | N | | -| Create_view_priv | enum('N','Y') | NO | | N | | -| Show_view_priv | enum('N','Y') | NO | | N | | -| Create_routine_priv | enum('N','Y') | NO | | N | | -| Alter_routine_priv | enum('N','Y') | NO | | N | | -| Index_priv | enum('N','Y') | NO | | N | | -| Create_user_priv | enum('N','Y') | NO | | N | | -| Event_priv | enum('N','Y') | NO | | N | | -| Repl_slave_priv | enum('N','Y') | NO | | N | | -| Repl_client_priv | enum('N','Y') | NO | | N | | -| Trigger_priv | enum('N','Y') | NO | | N | | -| Create_role_priv | enum('N','Y') | NO | | N | | -| Drop_role_priv | enum('N','Y') | NO | | N | | -| Account_locked | enum('N','Y') | NO | | N | | -| Shutdown_priv | enum('N','Y') | NO | | N | | -| Reload_priv | enum('N','Y') | NO | | N | | -| FILE_priv | enum('N','Y') | NO | | N | | -| Config_priv | enum('N','Y') | NO | | N | | -| Create_Tablespace_Priv | enum('N','Y') | NO | | N | | -| Password_reuse_history | smallint(5) unsigned | YES | | NULL | | -| Password_reuse_time | smallint(5) unsigned | YES | | NULL | | -| User_attributes | json | YES | | NULL | | -| Token_issuer | varchar(255) | YES | | NULL | | -| Password_expired | enum('N','Y') | NO | | N | | -| Password_last_changed | timestamp | YES | | CURRENT_TIMESTAMP | | -| Password_lifetime | smallint(5) unsigned | YES | | NULL | | -+------------------------+----------------------+------+------+-------------------+-------+ ++------------------------+-------------------+------+------+-------------------+-------+ +| Field | Type | Null | Key | Default | Extra | ++------------------------+-------------------+------+------+-------------------+-------+ +| Host | char(255) | NO | PRI | NULL | | +| User | char(32) | NO | PRI | NULL | | +| authentication_string | text | YES | | NULL | | +| plugin | char(64) | YES | | NULL | | +| Select_priv | enum('N','Y') | NO | | N | | +| Insert_priv | enum('N','Y') | NO | | N | | +| Update_priv | enum('N','Y') | NO | | N | | +| Delete_priv | enum('N','Y') | NO | | N | | +| Create_priv | enum('N','Y') | NO | | N | | +| Drop_priv | enum('N','Y') | NO | | N | | +| Process_priv | enum('N','Y') | NO | | N | | +| Grant_priv | enum('N','Y') | NO | | N | | +| References_priv | enum('N','Y') | NO | | N | | +| Alter_priv | enum('N','Y') | NO | | N | | +| Show_db_priv | enum('N','Y') | NO | | N | | +| Super_priv | enum('N','Y') | NO | | N | | +| Create_tmp_table_priv | enum('N','Y') | NO | | N | | +| Lock_tables_priv | enum('N','Y') | NO | | N | | +| Execute_priv | enum('N','Y') | NO | | N | | +| Create_view_priv | enum('N','Y') | NO | | N | | +| Show_view_priv | enum('N','Y') | NO | | N | | +| Create_routine_priv | enum('N','Y') | NO | | N | | +| Alter_routine_priv | enum('N','Y') | NO | | N | | +| Index_priv | enum('N','Y') | NO | | N | | +| Create_user_priv | enum('N','Y') | NO | | N | | +| Event_priv | enum('N','Y') | NO | | N | | +| Repl_slave_priv | enum('N','Y') | NO | | N | | +| Repl_client_priv | enum('N','Y') | NO | | N | | +| Trigger_priv | enum('N','Y') | NO | | N | | +| Create_role_priv | enum('N','Y') | NO | | N | | +| Drop_role_priv | enum('N','Y') | NO | | N | | +| Account_locked | enum('N','Y') | NO | | N | | +| Shutdown_priv | enum('N','Y') | NO | | N | | +| Reload_priv | enum('N','Y') | NO | | N | | +| FILE_priv | enum('N','Y') | NO | | N | | +| Config_priv | enum('N','Y') | NO | | N | | +| Create_Tablespace_Priv | enum('N','Y') | NO | | N | | +| Password_reuse_history | smallint unsigned | YES | | NULL | | +| Password_reuse_time | smallint unsigned | YES | | NULL | | +| User_attributes | json | YES | | NULL | | +| Token_issuer | varchar(255) | YES | | NULL | | +| Password_expired | enum('N','Y') | NO | | N | | +| Password_last_changed | timestamp | YES | | CURRENT_TIMESTAMP | | +| Password_lifetime | smallint unsigned | YES | | NULL | | ++------------------------+-------------------+------+------+-------------------+-------+ 44 rows in set (0.00 sec) ``` diff --git a/partitioned-table.md b/partitioned-table.md index da7bb15257e4..6a1989f32acd 100644 --- a/partitioned-table.md +++ b/partitioned-table.md @@ -262,7 +262,7 @@ INTERVAL (1 MONTH) FIRST PARTITION LESS THAN ('2000-01-01') LAST PARTITION LESS ```sql CREATE TABLE `monthly_report_status` ( - `report_id` int(11) NOT NULL, + `report_id` int NOT NULL, `report_status` varchar(20) NOT NULL, `report_date` date NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin @@ -1112,7 +1112,7 @@ SHOW CREATE TABLE\G *************************** 1. row *************************** Table: example Create Table: CREATE TABLE `example` ( - `id` int(11) NOT NULL, + `id` int NOT NULL, `data` varchar(1024) DEFAULT NULL, PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin @@ -1722,10 +1722,10 @@ SHOW CREATE TABLE t1\G ``` Table: t1 Create Table: CREATE TABLE `t1` ( - `col1` int(11) NOT NULL, + `col1` int NOT NULL, `col2` date NOT NULL, - `col3` int(11) NOT NULL, - `col4` int(11) NOT NULL, + `col3` int NOT NULL, + `col4` int NOT NULL, UNIQUE KEY `uidx12` (`col1`,`col2`) /*T![global_index] GLOBAL */, UNIQUE KEY `uidx3` (`col3`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin diff --git a/performance-schema/performance-schema-session-connect-attrs.md b/performance-schema/performance-schema-session-connect-attrs.md index 41879e5977a5..3126b1d45578 100644 --- a/performance-schema/performance-schema-session-connect-attrs.md +++ b/performance-schema/performance-schema-session-connect-attrs.md @@ -26,14 +26,14 @@ DESCRIBE session_connect_attrs; ``` ``` -+------------------+---------------------+------+-----+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+------------------+---------------------+------+-----+---------+-------+ -| PROCESSLIST_ID | bigint(20) unsigned | NO | | NULL | | -| ATTR_NAME | varchar(32) | NO | | NULL | | -| ATTR_VALUE | varchar(1024) | YES | | NULL | | -| ORDINAL_POSITION | int(11) | YES | | NULL | | -+------------------+---------------------+------+-----+---------+-------+ ++------------------+-----------------+------+------+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++------------------+-----------------+------+------+---------+-------+ +| PROCESSLIST_ID | bigint unsigned | NO | | NULL | | +| ATTR_NAME | varchar(32) | NO | | NULL | | +| ATTR_VALUE | varchar(1024) | YES | | NULL | | +| ORDINAL_POSITION | int | YES | | NULL | | ++------------------+-----------------+------+------+---------+-------+ ``` 你可以通过以下方式查看 `SESSION_CONNECT_ATTRS` 表中存储的会话属性信息: diff --git a/placement-rules-in-sql.md b/placement-rules-in-sql.md index cb9b10a5d4db..26ac3b35ab09 100644 --- a/placement-rules-in-sql.md +++ b/placement-rules-in-sql.md @@ -114,7 +114,7 @@ SHOW PLACEMENT LABELS; *************************** 1. row *************************** Table: t1 Create Table: CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL + `a` int DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin /*T![placement] PLACEMENT POLICY=`myplacementpolicy` */ 1 row in set (0.00 sec) ``` diff --git a/post-installation-check.md b/post-installation-check.md index bc1a5a449dd0..e34a7c8e63cb 100644 --- a/post-installation-check.md +++ b/post-installation-check.md @@ -131,9 +131,9 @@ Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. ```sql CREATE TABLE `tab_tidb` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int NOT NULL AUTO_INCREMENT, `name` varchar(20) NOT NULL DEFAULT '', - `age` int(11) NOT NULL DEFAULT 0, + `age` int NOT NULL DEFAULT 0, `version` varchar(20) NOT NULL DEFAULT '', PRIMARY KEY (`id`), KEY `idx_age` (`age`)); diff --git a/sql-plan-replayer.md b/sql-plan-replayer.md index 8cd77edd7cab..a482e472c1f3 100644 --- a/sql-plan-replayer.md +++ b/sql-plan-replayer.md @@ -162,12 +162,12 @@ set @@global.tidb_enable_auto_analyze = OFF; ```sql mysql> desc t; -+-------+---------+------+------+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+-------+---------+------+------+---------+-------+ -| a | int(11) | YES | | NULL | | -| b | int(11) | YES | | NULL | | -+-------+---------+------+------+---------+-------+ ++-------+------+------+------+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++-------+------+------+------+---------+-------+ +| a | int | YES | | NULL | | +| b | int | YES | | NULL | | ++-------+------+------+------+---------+-------+ 2 rows in set (0.01 sec) mysql> explain select * from t where a = 1 or b =1; diff --git a/sql-statements/sql-statement-alter-index.md b/sql-statements/sql-statement-alter-index.md index 67cac06bb6c9..5285954afd3a 100644 --- a/sql-statements/sql-statement-alter-index.md +++ b/sql-statements/sql-statement-alter-index.md @@ -45,7 +45,7 @@ SHOW CREATE TABLE t1; | +-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | t1 | CREATE TABLE `t1` ( - `c1` int(11) DEFAULT NULL, + `c1` int DEFAULT NULL, UNIQUE KEY `c1` (`c1`) /*!80000 INVISIBLE */ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin | +-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ diff --git a/sql-statements/sql-statement-create-table.md b/sql-statements/sql-statement-create-table.md index b324dd05e0cb..92583fddd737 100644 --- a/sql-statements/sql-statement-create-table.md +++ b/sql-statements/sql-statement-create-table.md @@ -167,18 +167,18 @@ mysql> CREATE TABLE t1 (a int); Query OK, 0 rows affected (0.09 sec) mysql> DESC t1; -+-------+---------+------+------+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+-------+---------+------+------+---------+-------+ -| a | int(11) | YES | | NULL | | -+-------+---------+------+------+---------+-------+ ++-------+------+------+------+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++-------+------+------+------+---------+-------+ +| a | int | YES | | NULL | | ++-------+------+------+------+---------+-------+ 1 row in set (0.00 sec) mysql> SHOW CREATE TABLE t1\G *************************** 1. row *************************** Table: t1 Create Table: CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL + `a` int DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin 1 row in set (0.00 sec) @@ -219,7 +219,7 @@ mysql> DESC t1; +-------+--------------+------+------+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+--------------+------+------+---------+----------------+ -| id | bigint(20) | NO | PRI | NULL | auto_increment | +| id | bigint | NO | PRI | NULL | auto_increment | | b | varchar(200) | NO | | NULL | | +-------+--------------+------+------+---------+----------------+ 2 rows in set (0.00 sec) diff --git a/sql-statements/sql-statement-modify-column.md b/sql-statements/sql-statement-modify-column.md index 6b75a5921878..1ee3e64654cf 100644 --- a/sql-statements/sql-statement-modify-column.md +++ b/sql-statements/sql-statement-modify-column.md @@ -95,8 +95,8 @@ SHOW CREATE TABLE t1\G *************************** 1. row *************************** Table: t1 Create Table: CREATE TABLE `t1` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `col1` bigint(20) DEFAULT NULL, + `id` int NOT NULL AUTO_INCREMENT, + `col1` bigint DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=30001 1 row in set (0.00 sec) @@ -145,7 +145,7 @@ SHOW CREATE TABLE t1\G *************************** 1. row *************************** Table: t1 CREATE TABLE `t1` ( - `id` int(11) NOT NULL AUTO_INCREMENT, + `id` int NOT NULL AUTO_INCREMENT, `col1` varchar(5) DEFAULT NULL, PRIMARY KEY (`id`) /*T![clustered_index] CLUSTERED */ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin AUTO_INCREMENT=30001 @@ -179,7 +179,7 @@ CREATE TABLE `t1` ( ```sql CREATE TABLE t (a int primary key); - ALTER TABLE t MODIFY COLUMN a INT(10) UNSIGNED; + ALTER TABLE t MODIFY COLUMN a int UNSIGNED; ERROR 8200 (HY000): Unsupported modify column: column has primary key flag ``` diff --git a/sql-statements/sql-statement-rename-index.md b/sql-statements/sql-statement-rename-index.md index 73888f3a4e81..7e296ceea6ba 100644 --- a/sql-statements/sql-statement-rename-index.md +++ b/sql-statements/sql-statement-rename-index.md @@ -40,8 +40,8 @@ SHOW CREATE TABLE t1; *************************** 1. row *************************** Table: t1 Create Table: CREATE TABLE `t1` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `c1` int(11) NOT NULL, + `id` int NOT NULL AUTO_INCREMENT, + `c1` int NOT NULL, PRIMARY KEY (`id`), KEY `col1` (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin @@ -68,8 +68,8 @@ SHOW CREATE TABLE t1; *************************** 1. row *************************** Table: t1 Create Table: CREATE TABLE `t1` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `c1` int(11) NOT NULL, + `id` int NOT NULL AUTO_INCREMENT, + `c1` int NOT NULL, PRIMARY KEY (`id`), KEY `c1` (`c1`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin diff --git a/sql-statements/sql-statement-show-columns-from.md b/sql-statements/sql-statement-show-columns-from.md index 210a6236903c..9d57c8c223bf 100644 --- a/sql-statements/sql-statement-show-columns-from.md +++ b/sql-statements/sql-statement-show-columns-from.md @@ -43,11 +43,11 @@ SHOW COLUMNS FROM v1; ``` ``` -+-------+-----------+------+------+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+-------+-----------+------+------+---------+-------+ -| 1 | bigint(1) | YES | | NULL | | -+-------+-----------+------+------+---------+-------+ ++-------+--------+------+------+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++-------+--------+------+------+---------+-------+ +| 1 | bigint | YES | | NULL | | ++-------+--------+------+------+---------+-------+ 1 row in set (0.00 sec) ``` @@ -56,11 +56,11 @@ DESC v1; ``` ``` -+-------+-----------+------+------+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+-------+-----------+------+------+---------+-------+ -| 1 | bigint(1) | YES | | NULL | | -+-------+-----------+------+------+---------+-------+ ++-------+--------+------+------+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++-------+--------+------+------+---------+-------+ +| 1 | bigint | YES | | NULL | | ++-------+--------+------+------+---------+-------+ 1 row in set (0.00 sec) ``` @@ -69,10 +69,10 @@ DESCRIBE v1; ``` ``` -+-------+-----------+------+------+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+-------+-----------+------+------+---------+-------+ -| 1 | bigint(1) | YES | | NULL | | ++-------+--------+------+------+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++-------+--------+------+------+---------+-------+ +| 1 | bigint | YES | | NULL | | +-------+-----------+------+------+---------+-------+ 1 row in set (0.00 sec) ``` @@ -82,11 +82,11 @@ EXPLAIN v1; ``` ``` -+-------+-----------+------+------+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+-------+-----------+------+------+---------+-------+ -| 1 | bigint(1) | YES | | NULL | | -+-------+-----------+------+------+---------+-------+ ++-------+--------+------+------+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++-------+--------+------+------+---------+-------+ +| 1 | bigint | YES | | NULL | | ++-------+--------+------+------+---------+-------+ 1 row in set (0.00 sec) ``` @@ -95,11 +95,11 @@ SHOW FIELDS FROM v1; ``` ``` -+-------+-----------+------+------+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+-------+-----------+------+------+---------+-------+ -| 1 | bigint(1) | YES | | NULL | | -+-------+-----------+------+------+---------+-------+ ++-------+--------+------+------+---------+-------+ +| Field | Type | Null | Key | Default | Extra | ++-------+--------+------+------+---------+-------+ +| 1 | bigint | YES | | NULL | | ++-------+--------+------+------+---------+-------+ 1 row in set (0.00 sec) ``` @@ -108,11 +108,11 @@ SHOW FULL COLUMNS FROM v1 ``` ``` -+-------+-----------+-----------+------+------+---------+-------+---------------------------------+---------+ -| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment | -+-------+-----------+-----------+------+------+---------+-------+---------------------------------+---------+ -| 1 | bigint(1) | NULL | YES | | NULL | | select,insert,update,references | | -+-------+-----------+-----------+------+------+---------+-------+---------------------------------+---------+ ++-------+--------+-----------+------+------+---------+-------+---------------------------------+---------+ +| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment | ++-------+--------+-----------+------+------+---------+-------+---------------------------------+---------+ +| 1 | bigint | NULL | YES | | NULL | | select,insert,update,references | | ++-------+--------+-----------+------+------+---------+-------+---------------------------------+---------+ 1 row in set (0.00 sec) ``` diff --git a/sql-statements/sql-statement-show-create-table.md b/sql-statements/sql-statement-show-create-table.md index fe59d54e5c75..4c3051064ce9 100644 --- a/sql-statements/sql-statement-show-create-table.md +++ b/sql-statements/sql-statement-show-create-table.md @@ -37,7 +37,7 @@ SHOW CREATE TABLE t1\G *************************** 1. row *************************** Table: t1 Create Table: CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL + `a` int DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin 1 row in set (0.00 sec) ``` diff --git a/sql-statements/sql-statement-show-placement-for.md b/sql-statements/sql-statement-show-placement-for.md index d2caa5ade273..fc95f667435a 100644 --- a/sql-statements/sql-statement-show-placement-for.md +++ b/sql-statements/sql-statement-show-placement-for.md @@ -63,7 +63,7 @@ Query OK, 0 rows affected (0.01 sec) ***************************[ 1. row ]*************************** Table | t1 Create Table | CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL + `a` int DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin /*T![placement] PLACEMENT POLICY=`p1` */ 1 row in set (0.00 sec) diff --git a/system-variables.md b/system-variables.md index 93eae17e05d4..baee7f7c70a9 100644 --- a/system-variables.md +++ b/system-variables.md @@ -1007,7 +1007,7 @@ mysql> SHOW CREATE TABLE t; | Table | Create Table | +-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | t | CREATE TABLE `t` ( - `a` int(11) DEFAULT NULL, + `a` int DEFAULT NULL, `b` varchar(10) DEFAULT NULL, `c` json DEFAULT NULL, `d` blob DEFAULT NULL, diff --git a/ticdc/integrate-confluent-using-ticdc.md b/ticdc/integrate-confluent-using-ticdc.md index 8bf4da0cc85c..3c2103af5ac5 100644 --- a/ticdc/integrate-confluent-using-ticdc.md +++ b/ticdc/integrate-confluent-using-ticdc.md @@ -198,8 +198,8 @@ Snowflake 是一种云原生数据仓库。借助 Confluent 的能力,你只 ``` CREATE TABLE `item` ( - `i_id` int(11) NOT NULL, - `i_im_id` int(11) DEFAULT NULL, + `i_id` int NOT NULL, + `i_im_id` int DEFAULT NULL, `i_name` varchar(24) DEFAULT NULL, `i_price` decimal(5,2) DEFAULT NULL, `i_data` varchar(50) DEFAULT NULL, diff --git a/ticdc/ticdc-faq.md b/ticdc/ticdc-faq.md index e0cefd64e2d1..dc238d29bfd3 100644 --- a/ticdc/ticdc-faq.md +++ b/ticdc/ticdc-faq.md @@ -330,7 +330,7 @@ mysql root@127.0.0.1:test> show create table test; | Table | Create Table | +-------+----------------------------------------------------------------------------------+ | test | CREATE TABLE `test` ( | -| | `id` int(11) NOT NULL, | +| | `id` int NOT NULL, | | | `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | | | PRIMARY KEY (`id`) | | | ) ENGINE=InnoDB DEFAULT CHARSET=latin1 | diff --git a/tidb-lightning/tidb-lightning-error-resolution.md b/tidb-lightning/tidb-lightning-error-resolution.md index ac278c8f701f..fece43f3946e 100644 --- a/tidb-lightning/tidb-lightning-error-resolution.md +++ b/tidb-lightning/tidb-lightning-error-resolution.md @@ -105,7 +105,7 @@ CREATE TABLE conflict_error_v3 ( raw_value mediumblob NOT NULL, raw_handle mediumblob NOT NULL, raw_row mediumblob NOT NULL, - kv_type tinyint(1) NOT NULL, + kv_type tinyint NOT NULL, INDEX (task_id, table_name), INDEX (index_name), INDEX (table_name, index_name), @@ -276,7 +276,7 @@ CREATE VIEW conflict_view AS table_name: `example`.`t` path: example.t.1.sql offset: 253 - error: failed to cast value as tinyint(4) for column `a` (#1): [types:1690]constant 600 overflows tinyint + error: failed to cast value as tinyint for column `a` (#1): [types:1690]constant 600 overflows tinyint row_data: (600,'six hundred') ``` diff --git a/tidb-lightning/tidb-lightning-physical-import-mode-usage.md b/tidb-lightning/tidb-lightning-physical-import-mode-usage.md index 486c23640e7c..bc5747646787 100644 --- a/tidb-lightning/tidb-lightning-physical-import-mode-usage.md +++ b/tidb-lightning/tidb-lightning-physical-import-mode-usage.md @@ -145,14 +145,14 @@ Lightning 的完整配置文件可参考[完整配置及命令行参数](/tidb-l ```sql CREATE TABLE IF NOT EXISTS `order_line` ( - `ol_o_id` int(11) NOT NULL, - `ol_d_id` int(11) NOT NULL, - `ol_w_id` int(11) NOT NULL, - `ol_number` int(11) NOT NULL, - `ol_i_id` int(11) NOT NULL, - `ol_supply_w_id` int(11) DEFAULT NULL, + `ol_o_id` int NOT NULL, + `ol_d_id` int NOT NULL, + `ol_w_id` int NOT NULL, + `ol_number` int NOT NULL, + `ol_i_id` int NOT NULL, + `ol_supply_w_id` int DEFAULT NULL, `ol_delivery_d` datetime DEFAULT NULL, - `ol_quantity` int(11) DEFAULT NULL, + `ol_quantity` int DEFAULT NULL, `ol_amount` decimal(6,2) DEFAULT NULL, `ol_dist_info` char(24) DEFAULT NULL, PRIMARY KEY (`ol_w_id`,`ol_d_id`,`ol_o_id`,`ol_number`) diff --git a/tiflash/use-tiflash-mpp-mode.md b/tiflash/use-tiflash-mpp-mode.md index b48fc2658915..be4c4eabf304 100644 --- a/tiflash/use-tiflash-mpp-mode.md +++ b/tiflash/use-tiflash-mpp-mode.md @@ -115,7 +115,7 @@ TiFlash 提供了 3 个全局/会话变量决定是否选择 Broadcast Hash Join mysql> DROP TABLE if exists test.employees; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> CREATE TABLE test.employees -(id int(11) NOT NULL, +(id int NOT NULL, fname varchar(30) DEFAULT NULL, lname varchar(30) DEFAULT NULL, hired date NOT NULL DEFAULT '1970-01-01',