From 7f140858b9f4e92f3ddc2d999fdceaff69d2d120 Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Thu, 1 Jul 2021 19:51:26 +0800 Subject: [PATCH] fix partition table doc error (#5903) (#5911) --- partitioned-table.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/partitioned-table.md b/partitioned-table.md index 94f6771c476da..f52fe657788b4 100644 --- a/partitioned-table.md +++ b/partitioned-table.md @@ -27,8 +27,8 @@ CREATE TABLE employees ( fname VARCHAR(30), lname VARCHAR(30), hired DATE NOT NULL DEFAULT '1970-01-01', - separated DATE NOT NULL DEFAULT '9999-12-31', - job_code INT NOT NULL, + separated DATE DEFAULT '9999-12-31', + job_code INT, store_id INT NOT NULL ); ``` @@ -43,8 +43,8 @@ CREATE TABLE employees ( fname VARCHAR(30), lname VARCHAR(30), hired DATE NOT NULL DEFAULT '1970-01-01', - separated DATE NOT NULL DEFAULT '9999-12-31', - job_code INT NOT NULL, + separated DATE DEFAULT '9999-12-31', + job_code INT, store_id INT NOT NULL ) @@ -58,7 +58,7 @@ PARTITION BY RANGE (store_id) ( In this partition scheme, all rows corresponding to employees whose `store_id` is 1 through 5 are stored in the `p0` partition while all employees whose `store_id` is 6 through 10 are stored in `p1`. Range partitioning requires the partitions to be ordered, from lowest to highest. -If you insert a row of data `(72, 'Tom', 'John', '2015-06-25', NULL, 15)`, it falls in the `p2` partition. But if you insert a record whose `store_id` is larger than 20, an error is reported because TiDB can not know which partition this record should be inserted into. In this case, you can use `MAXVALUE` when creating a table: +If you insert a row of data `(72, 'Tom', 'John', '2015-06-25', NULL, NULL, 15)`, it falls in the `p2` partition. But if you insert a record whose `store_id` is larger than 20, an error is reported because TiDB can not know which partition this record should be inserted into. In this case, you can use `MAXVALUE` when creating a table: {{< copyable "sql" >}} @@ -68,8 +68,8 @@ CREATE TABLE employees ( fname VARCHAR(30), lname VARCHAR(30), hired DATE NOT NULL DEFAULT '1970-01-01', - separated DATE NOT NULL DEFAULT '9999-12-31', - job_code INT NOT NULL, + separated DATE DEFAULT '9999-12-31', + job_code INT, store_id INT NOT NULL ) @@ -93,8 +93,8 @@ CREATE TABLE employees ( fname VARCHAR(30), lname VARCHAR(30), hired DATE NOT NULL DEFAULT '1970-01-01', - separated DATE NOT NULL DEFAULT '9999-12-31', - job_code INT NOT NULL, + separated DATE DEFAULT '9999-12-31', + job_code INT, store_id INT NOT NULL ) @@ -117,7 +117,7 @@ CREATE TABLE employees ( fname VARCHAR(30), lname VARCHAR(30), hired DATE NOT NULL DEFAULT '1970-01-01', - separated DATE NOT NULL DEFAULT '9999-12-31', + separated DATE DEFAULT '9999-12-31', job_code INT, store_id INT ) @@ -293,7 +293,7 @@ CREATE TABLE employees_1 ( fname VARCHAR(30), lname VARCHAR(30), hired DATE NOT NULL DEFAULT '1970-01-01', - separated DATE NOT NULL DEFAULT '9999-12-31', + separated DATE DEFAULT '9999-12-31', job_code INT, store_id INT, city VARCHAR(15) @@ -318,7 +318,7 @@ CREATE TABLE employees_2 ( fname VARCHAR(30), lname VARCHAR(30), hired DATE NOT NULL DEFAULT '1970-01-01', - separated DATE NOT NULL DEFAULT '9999-12-31', + separated DATE DEFAULT '9999-12-31', job_code INT, store_id INT, city VARCHAR(15) @@ -367,7 +367,7 @@ CREATE TABLE employees ( fname VARCHAR(30), lname VARCHAR(30), hired DATE NOT NULL DEFAULT '1970-01-01', - separated DATE NOT NULL DEFAULT '9999-12-31', + separated DATE DEFAULT '9999-12-31', job_code INT, store_id INT ) @@ -388,7 +388,7 @@ CREATE TABLE employees ( fname VARCHAR(30), lname VARCHAR(30), hired DATE NOT NULL DEFAULT '1970-01-01', - separated DATE NOT NULL DEFAULT '9999-12-31', + separated DATE DEFAULT '9999-12-31', job_code INT, store_id INT )