diff --git "a/data/2.MySQL\344\270\255\351\230\266/6.\345\255\220\346\237\245\350\257\242/6. NOT IN/config.json" "b/data/2.MySQL\344\270\255\351\230\266/6.\345\255\220\346\237\245\350\257\242/6. NOT IN/config.json" deleted file mode 100644 index 4396bd7bf0822e10e38f0c776e8c71a12131208a..0000000000000000000000000000000000000000 --- "a/data/2.MySQL\344\270\255\351\230\266/6.\345\255\220\346\237\245\350\257\242/6. NOT IN/config.json" +++ /dev/null @@ -1,11 +0,0 @@ -{ - "node_id": "mysql-06525286a9d4488d94e85b6bd36e3c1e", - "keywords": [], - "children": [], - "export": [], - "keywords_must": [ - ["mysql", "not in"] - ], - "keywords_forbid": [], - "group": 0 -} \ No newline at end of file diff --git "a/data/2.MySQL\344\270\255\351\230\266/6.\345\255\220\346\237\245\350\257\242/6. \345\210\227\345\255\220\346\237\245\350\257\242/config.json" "b/data/2.MySQL\344\270\255\351\230\266/6.\345\255\220\346\237\245\350\257\242/6. \345\210\227\345\255\220\346\237\245\350\257\242/config.json" new file mode 100644 index 0000000000000000000000000000000000000000..1084d94aa61f8bd3ed1c51ef4240aa50812940cd --- /dev/null +++ "b/data/2.MySQL\344\270\255\351\230\266/6.\345\255\220\346\237\245\350\257\242/6. \345\210\227\345\255\220\346\237\245\350\257\242/config.json" @@ -0,0 +1,19 @@ +{ + "node_id": "mysql-7bc092b1b1854dd3b88eed3a517b96a2", + "keywords": [ + "子查询", + "列子查询" + ], + "children": [], + "export": [ + "in_column.json" + ], + "keywords_must": [ + [ + "mysql", + "列子查询" + ] + ], + "keywords_forbid": [], + "group": 0 +} \ No newline at end of file diff --git "a/data/2.MySQL\344\270\255\351\230\266/6.\345\255\220\346\237\245\350\257\242/6. \345\210\227\345\255\220\346\237\245\350\257\242/in_clumn.json" "b/data/2.MySQL\344\270\255\351\230\266/6.\345\255\220\346\237\245\350\257\242/6. \345\210\227\345\255\220\346\237\245\350\257\242/in_clumn.json" new file mode 100644 index 0000000000000000000000000000000000000000..7b6fc6dd569185232260787743bd0bd6c23f751e --- /dev/null +++ "b/data/2.MySQL\344\270\255\351\230\266/6.\345\255\220\346\237\245\350\257\242/6. \345\210\227\345\255\220\346\237\245\350\257\242/in_clumn.json" @@ -0,0 +1,7 @@ +{ + "type": "code_options", + "author": "ccat", + "source": "in_column.md", + "notebook_enable": false, + "exercise_id": "2ded48602e384fc2b5476186e8b91842" +} \ No newline at end of file diff --git "a/data/2.MySQL\344\270\255\351\230\266/6.\345\255\220\346\237\245\350\257\242/6. \345\210\227\345\255\220\346\237\245\350\257\242/in_column.json" "b/data/2.MySQL\344\270\255\351\230\266/6.\345\255\220\346\237\245\350\257\242/6. \345\210\227\345\255\220\346\237\245\350\257\242/in_column.json" new file mode 100644 index 0000000000000000000000000000000000000000..e752896b436797f30f34a1fc877dfb60942e63eb --- /dev/null +++ "b/data/2.MySQL\344\270\255\351\230\266/6.\345\255\220\346\237\245\350\257\242/6. \345\210\227\345\255\220\346\237\245\350\257\242/in_column.json" @@ -0,0 +1,7 @@ +{ + "type": "code_options", + "author": null, + "source": "in_column.md", + "notebook_enable": false, + "exercise_id": "464fd8f686284280afbee9424ed4ae65" +} \ No newline at end of file diff --git "a/data/2.MySQL\344\270\255\351\230\266/6.\345\255\220\346\237\245\350\257\242/6. \345\210\227\345\255\220\346\237\245\350\257\242/in_column.md" "b/data/2.MySQL\344\270\255\351\230\266/6.\345\255\220\346\237\245\350\257\242/6. \345\210\227\345\255\220\346\237\245\350\257\242/in_column.md" new file mode 100644 index 0000000000000000000000000000000000000000..d8da06590ca9addd677308c2497ef1b5d74b02db --- /dev/null +++ "b/data/2.MySQL\344\270\255\351\230\266/6.\345\255\220\346\237\245\350\257\242/6. \345\210\227\345\255\220\346\237\245\350\257\242/in_column.md" @@ -0,0 +1,22 @@ +# 列子查询 + +Joe 打算写一个查询,根据员工表 + +```mysql +create table employee( + id int primary key auto_increment, + dept varchar(256), + name varchar(256), + post varchar(16) +) +``` + +统计每个部门的人数,但是他不打算用 group by。那么还可以怎做? + +## 答案 + +```mysql +select distinct(dept) as dept, + (select count(*) from employee as i where i.dept=o.dept) as emp +from employee as o +``` \ No newline at end of file diff --git "a/data/2.MySQL\344\270\255\351\230\266/6.\345\255\220\346\237\245\350\257\242/7. \345\210\227\345\255\220\346\237\245\350\257\242/config.json" "b/data/2.MySQL\344\270\255\351\230\266/6.\345\255\220\346\237\245\350\257\242/7. \345\210\227\345\255\220\346\237\245\350\257\242/config.json" deleted file mode 100644 index 8092e67cb6e218315f274cc64c9caf2c71937a00..0000000000000000000000000000000000000000 --- "a/data/2.MySQL\344\270\255\351\230\266/6.\345\255\220\346\237\245\350\257\242/7. \345\210\227\345\255\220\346\237\245\350\257\242/config.json" +++ /dev/null @@ -1,11 +0,0 @@ -{ - "node_id": "mysql-7bc092b1b1854dd3b88eed3a517b96a2", - "keywords": ["子查询", "列子查询"], - "children": [], - "export": [], - "keywords_must": [ - ["mysql", "列子查询"] - ], - "keywords_forbid": [], - "group": 0 -} \ No newline at end of file diff --git a/data/tree.json b/data/tree.json index 7603111d3695b12f2a2d8d26776ba3e3ee63a2f4..179523e1e238569cd4cfc70d8d2c5c5a75db1feb 100644 --- a/data/tree.json +++ b/data/tree.json @@ -1240,21 +1240,6 @@ "group": 0 } }, - { - " NOT IN": { - "node_id": "mysql-06525286a9d4488d94e85b6bd36e3c1e", - "keywords": [], - "children": [], - "keywords_must": [ - [ - "mysql", - "not in" - ] - ], - "keywords_forbid": [], - "group": 0 - } - }, { " 列子查询": { "node_id": "mysql-7bc092b1b1854dd3b88eed3a517b96a2",