From 34901cee857a5a03db95f85791955708f43aeab6 Mon Sep 17 00:00:00 2001 From: Mars Liu Date: Wed, 1 Jun 2022 16:23:44 +0800 Subject: [PATCH] generated --- .../config.json" | 5 ++- .../generated.json" | 7 ++++ .../generated.md" | 39 +++++++++++++++++++ data/tree.json | 2 +- 4 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/1.\347\224\237\346\210\220\345\210\227/generated.json" create mode 100644 "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/1.\347\224\237\346\210\220\345\210\227/generated.md" diff --git "a/data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/1.\347\224\237\346\210\220\345\210\227/config.json" "b/data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/1.\347\224\237\346\210\220\345\210\227/config.json" index b462ddf..c1eff86 100644 --- "a/data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/1.\347\224\237\346\210\220\345\210\227/config.json" +++ "b/data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/1.\347\224\237\346\210\220\345\210\227/config.json" @@ -3,5 +3,8 @@ "keywords": [], "keywords_must": [], "keywords_forbid": [], - "group": 0 + "group": 2, + "export": [ + "generated.json" + ] } \ No newline at end of file diff --git "a/data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/1.\347\224\237\346\210\220\345\210\227/generated.json" "b/data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/1.\347\224\237\346\210\220\345\210\227/generated.json" new file mode 100644 index 0000000..2d2aba2 --- /dev/null +++ "b/data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/1.\347\224\237\346\210\220\345\210\227/generated.json" @@ -0,0 +1,7 @@ +{ + "type": "code_options", + "author": "ccat", + "source": "generated.md", + "notebook_enable": false, + "exercise_id": "e09151d6764e4e14bd088c858db0a0e3" +} \ No newline at end of file diff --git "a/data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/1.\347\224\237\346\210\220\345\210\227/generated.md" "b/data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/1.\347\224\237\346\210\220\345\210\227/generated.md" new file mode 100644 index 0000000..5b972d9 --- /dev/null +++ "b/data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/1.\347\224\237\346\210\220\345\210\227/generated.md" @@ -0,0 +1,39 @@ +# 生成列 + +Joe 需要为 Points 表 + +```mysql +create table points( + id int primary key auto_increment, + x float, + y float +) +``` + +增加一个生成列,保存每个点的模(modulus),即 `√(x^2 + y^2)` 。下面哪个操作是正确的? + +## 答案 + +```mysql +alter table points add modulus double generated always as (sqrt(x*x + y*y)); +``` + +## 选项 + +### A + +```mysql +create generated modulus on table points as (sqrt(x*x + y*y)); +``` + +### B + +```mysql +alter table points add modulus generated always as (sqrt(x*x + y*y)); +``` + +### C + +```mysql +alter table points add modulus float generated sqrt(x*x + y*y); +``` diff --git a/data/tree.json b/data/tree.json index b8cb101..4b73a0b 100644 --- a/data/tree.json +++ b/data/tree.json @@ -2233,7 +2233,7 @@ "children": [], "keywords_must": [], "keywords_forbid": [], - "group": 0 + "group": 2 } }, { -- GitLab