Skip to content

Commit

Permalink
Add examples for generated columns (pingcap#9955)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomShawn authored Jun 22, 2022
1 parent 23fbb67 commit efe1945
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion generated-columns.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ CREATE TABLE person (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
address_info JSON,
city VARCHAR(64) AS (JSON_UNQUOTE(JSON_EXTRACT(address_info, '$.city'))),
city VARCHAR(64) AS (JSON_UNQUOTE(JSON_EXTRACT(address_info, '$.city'))), -- 虚拟生成列
-- city VARCHAR(64) AS (JSON_UNQUOTE(JSON_EXTRACT(address_info, '$.city'))) VIRTUAL, -- 虚拟生成列
-- city VARCHAR(64) AS (JSON_UNQUOTE(JSON_EXTRACT(address_info, '$.city'))) STORED, -- 存储生成列
KEY (city)
);
```
Expand Down

0 comments on commit efe1945

Please sign in to comment.