From fd30a1a2e2788fe36aac082bf32898bb503a0e6b Mon Sep 17 00:00:00 2001 From: Mars Liu Date: Thu, 26 May 2022 18:26:50 +0800 Subject: [PATCH] double not exists problem --- .../config.json" | 0 .../trigger.json" | 0 .../trigger.md" | 0 .../config.json" | 2 +- .../4.Double Not Exists/DoubleNotExists.json" | 7 ++ .../4.Double Not Exists/DoubleNotExists.md" | 91 +++++++++++++++++++ .../4.Double Not Exists/config.json" | 15 +++ .../config.json" | 0 .../score.json" | 0 .../score.md" | 0 .../6.\344\272\213\345\212\241/config.json" | 0 .../transaction.json" | 0 .../transaction.md" | 0 .../config.json" | 0 .../daily_payment.json" | 0 .../daily_payment.md" | 0 .../config.json" | 0 .../config.json" | 11 +++ .../customer_order.json" | 0 .../customer_order.md" | 0 .../config.json" | 0 .../config.json" | 0 .../config.json" | 2 +- .../config.json" | 0 .../config.json" | 0 .../config.json" | 0 data/tree.json | 40 +++++--- gears/sql/bids.sql | 35 +++++++ 28 files changed, 188 insertions(+), 15 deletions(-) rename "data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/7. \350\247\246\345\217\221\345\231\250/config.json" => "data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/6. \350\247\246\345\217\221\345\231\250/config.json" (100%) rename "data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/7. \350\247\246\345\217\221\345\231\250/trigger.json" => "data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/6. \350\247\246\345\217\221\345\231\250/trigger.json" (100%) rename "data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/7. \350\247\246\345\217\221\345\231\250/trigger.md" => "data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/6. \350\247\246\345\217\221\345\231\250/trigger.md" (100%) rename "data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/8.\345\255\230\345\202\250\345\274\225\346\223\216/config.json" => "data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/7.\345\255\230\345\202\250\345\274\225\346\223\216/config.json" (70%) create mode 100644 "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.Double Not Exists/DoubleNotExists.json" create mode 100644 "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.Double Not Exists/DoubleNotExists.md" create mode 100644 "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.Double Not Exists/config.json" rename "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.\345\206\231\345\205\245\345\222\214\345\206\262\347\252\201/config.json" => "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/5.\345\206\231\345\205\245\345\222\214\345\206\262\347\252\201/config.json" (100%) rename "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.\345\206\231\345\205\245\345\222\214\345\206\262\347\252\201/score.json" => "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/5.\345\206\231\345\205\245\345\222\214\345\206\262\347\252\201/score.json" (100%) rename "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.\345\206\231\345\205\245\345\222\214\345\206\262\347\252\201/score.md" => "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/5.\345\206\231\345\205\245\345\222\214\345\206\262\347\252\201/score.md" (100%) rename "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/5.\344\272\213\345\212\241/config.json" => "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/6.\344\272\213\345\212\241/config.json" (100%) rename "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/5.\344\272\213\345\212\241/transaction.json" => "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/6.\344\272\213\345\212\241/transaction.json" (100%) rename "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/5.\344\272\213\345\212\241/transaction.md" => "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/6.\344\272\213\345\212\241/transaction.md" (100%) rename "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/6.\347\264\242\345\274\225\345\222\214\344\274\230\345\214\226/config.json" => "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/7.\347\264\242\345\274\225\345\222\214\344\274\230\345\214\226/config.json" (100%) rename "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/6.\347\264\242\345\274\225\345\222\214\344\274\230\345\214\226/daily_payment.json" => "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/7.\347\264\242\345\274\225\345\222\214\344\274\230\345\214\226/daily_payment.json" (100%) rename "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/6.\347\264\242\345\274\225\345\222\214\344\274\230\345\214\226/daily_payment.md" => "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/7.\347\264\242\345\274\225\345\222\214\344\274\230\345\214\226/daily_payment.md" (100%) rename "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/9.\346\213\206\345\210\206\346\225\260\346\215\256\350\241\250/config.json" => "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/10.\346\213\206\345\210\206\346\225\260\346\215\256\350\241\250/config.json" (100%) 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/3. \350\214\203\345\274\217\350\256\276\350\256\241/config.json" rename "data/2.MySQL\344\270\255\351\230\266/4.\350\277\236\346\216\245\346\237\245\350\257\242/customer_order.json" => "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/3. \350\214\203\345\274\217\350\256\276\350\256\241/customer_order.json" (100%) rename "data/2.MySQL\344\270\255\351\230\266/4.\350\277\236\346\216\245\346\237\245\350\257\242/customer_order.md" => "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/3. \350\214\203\345\274\217\350\256\276\350\256\241/customer_order.md" (100%) rename "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/3.\345\217\215\350\214\203\345\274\217\350\256\276\350\256\241/config.json" => "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/4.\345\217\215\350\214\203\345\274\217\350\256\276\350\256\241/config.json" (100%) rename "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/4.\346\270\205\347\220\206\351\207\215\345\244\215\347\264\242\345\274\225\345\222\214\345\206\227\344\275\231\347\264\242\345\274\225/config.json" => "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/5.\346\270\205\347\220\206\351\207\215\345\244\215\347\264\242\345\274\225\345\222\214\345\206\227\344\275\231\347\264\242\345\274\225/config.json" (100%) rename "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/5.\345\242\236\345\212\240\344\270\255\351\227\264\350\241\250/config.json" => "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/6.\345\242\236\345\212\240\344\270\255\351\227\264\350\241\250/config.json" (79%) rename "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/6.\345\210\206\346\236\220\346\225\260\346\215\256\350\241\250/config.json" => "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/7.\345\210\206\346\236\220\346\225\260\346\215\256\350\241\250/config.json" (100%) rename "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/7.\346\243\200\346\237\245\346\225\260\346\215\256\350\241\250/config.json" => "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/8.\346\243\200\346\237\245\346\225\260\346\215\256\350\241\250/config.json" (100%) rename "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/8.\344\274\230\345\214\226\346\225\260\346\215\256\350\241\250/config.json" => "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/9.\344\274\230\345\214\226\346\225\260\346\215\256\350\241\250/config.json" (100%) create mode 100644 gears/sql/bids.sql diff --git "a/data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/7. \350\247\246\345\217\221\345\231\250/config.json" "b/data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/6. \350\247\246\345\217\221\345\231\250/config.json" similarity index 100% rename from "data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/7. \350\247\246\345\217\221\345\231\250/config.json" rename to "data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/6. \350\247\246\345\217\221\345\231\250/config.json" diff --git "a/data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/7. \350\247\246\345\217\221\345\231\250/trigger.json" "b/data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/6. \350\247\246\345\217\221\345\231\250/trigger.json" similarity index 100% rename from "data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/7. \350\247\246\345\217\221\345\231\250/trigger.json" rename to "data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/6. \350\247\246\345\217\221\345\231\250/trigger.json" diff --git "a/data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/7. \350\247\246\345\217\221\345\231\250/trigger.md" "b/data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/6. \350\247\246\345\217\221\345\231\250/trigger.md" similarity index 100% rename from "data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/7. \350\247\246\345\217\221\345\231\250/trigger.md" rename to "data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/6. \350\247\246\345\217\221\345\231\250/trigger.md" diff --git "a/data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/8.\345\255\230\345\202\250\345\274\225\346\223\216/config.json" "b/data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/7.\345\255\230\345\202\250\345\274\225\346\223\216/config.json" similarity index 70% rename from "data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/8.\345\255\230\345\202\250\345\274\225\346\223\216/config.json" rename to "data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/7.\345\255\230\345\202\250\345\274\225\346\223\216/config.json" index f8b0c9e..50f2c53 100644 --- "a/data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/8.\345\255\230\345\202\250\345\274\225\346\223\216/config.json" +++ "b/data/2.MySQL\344\270\255\351\230\266/1.\346\225\260\346\215\256\345\272\223\347\273\204\346\210\220/7.\345\255\230\345\202\250\345\274\225\346\223\216/config.json" @@ -1,6 +1,6 @@ { "node_id": "mysql-af89d54d66974111b4f67aeba2af7161", - "keywords": [], + "keywords": ["engine", "innodb", "myisam"], "children": [], "export": [], "keywords_must": [] diff --git "a/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.Double Not Exists/DoubleNotExists.json" "b/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.Double Not Exists/DoubleNotExists.json" new file mode 100644 index 0000000..3712b39 --- /dev/null +++ "b/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.Double Not Exists/DoubleNotExists.json" @@ -0,0 +1,7 @@ +{ + "type": "code_options", + "author": "Mars Liu", + "source": "DoubleNotExists.md", + "notebook_enable": false, + "exercise_id": "2fabb69f22224e48a26fec8911798ceb" +} \ No newline at end of file diff --git "a/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.Double Not Exists/DoubleNotExists.md" "b/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.Double Not Exists/DoubleNotExists.md" new file mode 100644 index 0000000..f7a0297 --- /dev/null +++ "b/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.Double Not Exists/DoubleNotExists.md" @@ -0,0 +1,91 @@ +# Double Not Exists Check + +风控部们的数据库中有一组关于招投标的数据,关键信息如下: + +```mysql +-- 招标项目 +create table invitation +( + id int primary key auto_increment, + name varchar(256), + attachment text + -- ignore more detail ... +); + +-- 竞标企业 +create table company +( + id int primary key auto_increment, + name varchar(256) + -- ignore more detail ... +); + +-- 投标记录 +create table bids +( + id int primary key auto_increment, + invitation_id int references invitation (id), + company_id int references company (id) + -- ignore more detail ... +); + +``` + +Joe 想要找出参与了所有投标的企业(有围标嫌疑),那么这个查询应该怎么写? + +## 答案 + +```mysql +select * +from company +where not exists( + select * + from invitation + where not exists( + select * + from bids + where invitation.id = bids.invitation_id + and bids.company_id = company.id + ) + ) +``` + +## 选项 + +### A + +```mysql +select * +from company +where id = all (select company_id + from bids) +``` + +### B + +```mysql +select * +from company +where id = any (select company_id + from bids) +``` + +### C + +```mysql +select * +from company +where company.id in (select distinct company_id from bids) +``` + +### D + +```mysql +select * +from company +where exists( + select * + from bids + where bids.company_id = company.id + ) +``` \ No newline at end of file diff --git "a/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.Double Not Exists/config.json" "b/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.Double Not Exists/config.json" new file mode 100644 index 0000000..cc7af85 --- /dev/null +++ "b/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.Double Not Exists/config.json" @@ -0,0 +1,15 @@ +{ + "node_id": "mysql-72761d60ad7c4a9a9c87435daca246b9", + "keywords": [ + "exists", + "not exists", + "double not exists" + ], + "children": [], + "export": [ + "DoubleNotExists.json" + ], + "keywords_must": [], + "keywords_forbid": [], + "groups": 2 +} \ No newline at end of file diff --git "a/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.\345\206\231\345\205\245\345\222\214\345\206\262\347\252\201/config.json" "b/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/5.\345\206\231\345\205\245\345\222\214\345\206\262\347\252\201/config.json" similarity index 100% rename from "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.\345\206\231\345\205\245\345\222\214\345\206\262\347\252\201/config.json" rename to "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/5.\345\206\231\345\205\245\345\222\214\345\206\262\347\252\201/config.json" diff --git "a/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.\345\206\231\345\205\245\345\222\214\345\206\262\347\252\201/score.json" "b/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/5.\345\206\231\345\205\245\345\222\214\345\206\262\347\252\201/score.json" similarity index 100% rename from "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.\345\206\231\345\205\245\345\222\214\345\206\262\347\252\201/score.json" rename to "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/5.\345\206\231\345\205\245\345\222\214\345\206\262\347\252\201/score.json" diff --git "a/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.\345\206\231\345\205\245\345\222\214\345\206\262\347\252\201/score.md" "b/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/5.\345\206\231\345\205\245\345\222\214\345\206\262\347\252\201/score.md" similarity index 100% rename from "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/4.\345\206\231\345\205\245\345\222\214\345\206\262\347\252\201/score.md" rename to "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/5.\345\206\231\345\205\245\345\222\214\345\206\262\347\252\201/score.md" diff --git "a/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/5.\344\272\213\345\212\241/config.json" "b/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/6.\344\272\213\345\212\241/config.json" similarity index 100% rename from "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/5.\344\272\213\345\212\241/config.json" rename to "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/6.\344\272\213\345\212\241/config.json" diff --git "a/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/5.\344\272\213\345\212\241/transaction.json" "b/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/6.\344\272\213\345\212\241/transaction.json" similarity index 100% rename from "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/5.\344\272\213\345\212\241/transaction.json" rename to "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/6.\344\272\213\345\212\241/transaction.json" diff --git "a/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/5.\344\272\213\345\212\241/transaction.md" "b/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/6.\344\272\213\345\212\241/transaction.md" similarity index 100% rename from "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/5.\344\272\213\345\212\241/transaction.md" rename to "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/6.\344\272\213\345\212\241/transaction.md" diff --git "a/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/6.\347\264\242\345\274\225\345\222\214\344\274\230\345\214\226/config.json" "b/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/7.\347\264\242\345\274\225\345\222\214\344\274\230\345\214\226/config.json" similarity index 100% rename from "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/6.\347\264\242\345\274\225\345\222\214\344\274\230\345\214\226/config.json" rename to "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/7.\347\264\242\345\274\225\345\222\214\344\274\230\345\214\226/config.json" diff --git "a/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/6.\347\264\242\345\274\225\345\222\214\344\274\230\345\214\226/daily_payment.json" "b/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/7.\347\264\242\345\274\225\345\222\214\344\274\230\345\214\226/daily_payment.json" similarity index 100% rename from "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/6.\347\264\242\345\274\225\345\222\214\344\274\230\345\214\226/daily_payment.json" rename to "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/7.\347\264\242\345\274\225\345\222\214\344\274\230\345\214\226/daily_payment.json" diff --git "a/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/6.\347\264\242\345\274\225\345\222\214\344\274\230\345\214\226/daily_payment.md" "b/data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/7.\347\264\242\345\274\225\345\222\214\344\274\230\345\214\226/daily_payment.md" similarity index 100% rename from "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/6.\347\264\242\345\274\225\345\222\214\344\274\230\345\214\226/daily_payment.md" rename to "data/3.MySQL\351\253\230\351\230\266/3.SQL\351\253\230\347\272\247\346\212\200\345\267\247/7.\347\264\242\345\274\225\345\222\214\344\274\230\345\214\226/daily_payment.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/9.\346\213\206\345\210\206\346\225\260\346\215\256\350\241\250/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/10.\346\213\206\345\210\206\346\225\260\346\215\256\350\241\250/config.json" similarity index 100% rename from "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/9.\346\213\206\345\210\206\346\225\260\346\215\256\350\241\250/config.json" rename to "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/10.\346\213\206\345\210\206\346\225\260\346\215\256\350\241\250/config.json" 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/3. \350\214\203\345\274\217\350\256\276\350\256\241/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/3. \350\214\203\345\274\217\350\256\276\350\256\241/config.json" new file mode 100644 index 0000000..23fa08f --- /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/3. \350\214\203\345\274\217\350\256\276\350\256\241/config.json" @@ -0,0 +1,11 @@ +{ + "node_id": "mysql-bee8db3dd5354a42bb50277fe4cb2913", + "keywords": [], + "children": [], + "export": [ + "customer_order.json" + ], + "keywords_must": [], + "keywords_forbid": [], + "group": 2 +} \ No newline at end of file diff --git "a/data/2.MySQL\344\270\255\351\230\266/4.\350\277\236\346\216\245\346\237\245\350\257\242/customer_order.json" "b/data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/3. \350\214\203\345\274\217\350\256\276\350\256\241/customer_order.json" similarity index 100% rename from "data/2.MySQL\344\270\255\351\230\266/4.\350\277\236\346\216\245\346\237\245\350\257\242/customer_order.json" rename to "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/3. \350\214\203\345\274\217\350\256\276\350\256\241/customer_order.json" diff --git "a/data/2.MySQL\344\270\255\351\230\266/4.\350\277\236\346\216\245\346\237\245\350\257\242/customer_order.md" "b/data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/3. \350\214\203\345\274\217\350\256\276\350\256\241/customer_order.md" similarity index 100% rename from "data/2.MySQL\344\270\255\351\230\266/4.\350\277\236\346\216\245\346\237\245\350\257\242/customer_order.md" rename to "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/3. \350\214\203\345\274\217\350\256\276\350\256\241/customer_order.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/3.\345\217\215\350\214\203\345\274\217\350\256\276\350\256\241/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/4.\345\217\215\350\214\203\345\274\217\350\256\276\350\256\241/config.json" similarity index 100% rename from "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/3.\345\217\215\350\214\203\345\274\217\350\256\276\350\256\241/config.json" rename to "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/4.\345\217\215\350\214\203\345\274\217\350\256\276\350\256\241/config.json" 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/4.\346\270\205\347\220\206\351\207\215\345\244\215\347\264\242\345\274\225\345\222\214\345\206\227\344\275\231\347\264\242\345\274\225/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/5.\346\270\205\347\220\206\351\207\215\345\244\215\347\264\242\345\274\225\345\222\214\345\206\227\344\275\231\347\264\242\345\274\225/config.json" similarity index 100% rename from "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/4.\346\270\205\347\220\206\351\207\215\345\244\215\347\264\242\345\274\225\345\222\214\345\206\227\344\275\231\347\264\242\345\274\225/config.json" rename to "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/5.\346\270\205\347\220\206\351\207\215\345\244\215\347\264\242\345\274\225\345\222\214\345\206\227\344\275\231\347\264\242\345\274\225/config.json" 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/5.\345\242\236\345\212\240\344\270\255\351\227\264\350\241\250/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/6.\345\242\236\345\212\240\344\270\255\351\227\264\350\241\250/config.json" similarity index 79% rename from "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/5.\345\242\236\345\212\240\344\270\255\351\227\264\350\241\250/config.json" rename to "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/6.\345\242\236\345\212\240\344\270\255\351\227\264\350\241\250/config.json" index f5d96a0..a6fa517 100644 --- "a/data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/5.\345\242\236\345\212\240\344\270\255\351\227\264\350\241\250/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/6.\345\242\236\345\212\240\344\270\255\351\227\264\350\241\250/config.json" @@ -1,6 +1,6 @@ { "node_id": "mysql-a2ddae1b044149ecbb74db3b6eb32721", - "keywords": [], + "keywords": ["middle", "中间表"], "children": [], "export": [], "keywords_must": [], 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/6.\345\210\206\346\236\220\346\225\260\346\215\256\350\241\250/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/7.\345\210\206\346\236\220\346\225\260\346\215\256\350\241\250/config.json" similarity index 100% rename from "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/6.\345\210\206\346\236\220\346\225\260\346\215\256\350\241\250/config.json" rename to "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/7.\345\210\206\346\236\220\346\225\260\346\215\256\350\241\250/config.json" 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/7.\346\243\200\346\237\245\346\225\260\346\215\256\350\241\250/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/8.\346\243\200\346\237\245\346\225\260\346\215\256\350\241\250/config.json" similarity index 100% rename from "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/7.\346\243\200\346\237\245\346\225\260\346\215\256\350\241\250/config.json" rename to "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/8.\346\243\200\346\237\245\346\225\260\346\215\256\350\241\250/config.json" 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/8.\344\274\230\345\214\226\346\225\260\346\215\256\350\241\250/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/9.\344\274\230\345\214\226\346\225\260\346\215\256\350\241\250/config.json" similarity index 100% rename from "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/8.\344\274\230\345\214\226\346\225\260\346\215\256\350\241\250/config.json" rename to "data/3.MySQL\351\253\230\351\230\266/5.\350\256\276\350\256\241\344\274\230\345\214\226/9.\344\274\230\345\214\226\346\225\260\346\215\256\350\241\250/config.json" diff --git a/data/tree.json b/data/tree.json index 8b6918f..fe51249 100644 --- a/data/tree.json +++ b/data/tree.json @@ -93,7 +93,12 @@ { " 创建和删除数据库": { "node_id": "mysql-764d5080ddb943fe9236922984afa152", - "keywords": [], + "keywords": [ + "create database", + "drop database", + "创建数据库", + "删除数据库" + ], "children": [], "keywords_must": [], "keywords_forbid": [] @@ -120,7 +125,10 @@ { "存储引擎": { "node_id": "mysql-cd45ce715f914ef2895df639a5d206a3", - "keywords": [], + "keywords": [ + "engine", + "存储引擎" + ], "children": [], "keywords_must": [], "keywords_forbid": [] @@ -483,15 +491,6 @@ "keywords_forbid": [] } }, - { - "存储引擎": { - "node_id": "mysql-af89d54d66974111b4f67aeba2af7161", - "keywords": [], - "children": [], - "keywords_must": [], - "keywords_forbid": [] - } - }, { " 触发器": { "node_id": "mysql-d1d26b008711441f82192c33e1fe4dd7", @@ -529,7 +528,10 @@ { " 别名": { "node_id": "mysql-1d350c6226d443bdb76b5058d8ee23e7", - "keywords": [], + "keywords": [ + "aliases", + "别名" + ], "children": [], "keywords_must": [], "keywords_forbid": [] @@ -640,7 +642,10 @@ { " 求和": { "node_id": "mysql-c5654c150993418a96f692496837fbb7", - "keywords": [], + "keywords": [ + "sum", + "求和" + ], "children": [], "keywords_must": [], "keywords_forbid": [] @@ -1766,6 +1771,15 @@ "keywords_forbid": [] } }, + { + " 范式设计": { + "node_id": "mysql-bee8db3dd5354a42bb50277fe4cb2913", + "keywords": [], + "children": [], + "keywords_must": [], + "keywords_forbid": [] + } + }, { "反范式设计": { "node_id": "mysql-3e4c837b471c454c90bfbc32445f2780", diff --git a/gears/sql/bids.sql b/gears/sql/bids.sql new file mode 100644 index 0000000..e85a5f4 --- /dev/null +++ b/gears/sql/bids.sql @@ -0,0 +1,35 @@ +create table invitation +( + id int primary key auto_increment, + name varchar(256), + attachment text + -- ignore more detail ... +); + +create table company( + id int primary key auto_increment, + name varchar(256) + -- ignore more detail ... +); + +create table bids +( + id int primary key auto_increment, + invitation_id int references invitation(id), + company_id int references company(id) + -- ignore more detail ... +); + +-- double not exists sample +select * +from company +where not exists( + select * + from invitation + where not exists( + select * + from bids + where invitation.id = bids.invitation_id + and bids.company_id = company.id + ) + ) \ No newline at end of file -- GitLab