From 4fdd7aec40679862dd135b69c7209606f59bae19 Mon Sep 17 00:00:00 2001 From: luxin Date: Fri, 8 Jul 2022 14:06:31 +0800 Subject: [PATCH] bug fixed for exercises --- .../2. \346\261\202\345\222\214/sum.md" | 10 ++-------- .../3.\346\234\200\345\260\217\345\200\274/min.md" | 8 +------- .../5. \345\271\263\345\235\207\345\200\274/avg.md" | 10 ++-------- .../create_index.md" | 2 +- 4 files changed, 6 insertions(+), 24 deletions(-) diff --git "a/data/2.MySQL\344\270\255\351\230\266/4.\350\201\232\345\220\210\345\222\214\345\210\206\347\273\204/2. \346\261\202\345\222\214/sum.md" "b/data/2.MySQL\344\270\255\351\230\266/4.\350\201\232\345\220\210\345\222\214\345\210\206\347\273\204/2. \346\261\202\345\222\214/sum.md" index 641180d..c8577bd 100644 --- "a/data/2.MySQL\344\270\255\351\230\266/4.\350\201\232\345\220\210\345\222\214\345\210\206\347\273\204/2. \346\261\202\345\222\214/sum.md" +++ "b/data/2.MySQL\344\270\255\351\230\266/4.\350\201\232\345\220\210\345\222\214\345\210\206\347\273\204/2. \346\261\202\345\222\214/sum.md" @@ -34,23 +34,17 @@ select sum(total) from orders where deal and unit_price > 1000; ### A -```sql -select sum(total) from orders where deal and unit_price > 1000; -``` - -### B - ```sql select sum(total) from orders having deal and unit_price > 1000; ``` -### C +### B ```sql select sum(total) from orders group by deal having unit_price > 1000; ``` -### D +### C ```sql select sum(total) from orders having deal and unit_price > 1000; diff --git "a/data/2.MySQL\344\270\255\351\230\266/4.\350\201\232\345\220\210\345\222\214\345\210\206\347\273\204/3.\346\234\200\345\260\217\345\200\274/min.md" "b/data/2.MySQL\344\270\255\351\230\266/4.\350\201\232\345\220\210\345\222\214\345\210\206\347\273\204/3.\346\234\200\345\260\217\345\200\274/min.md" index bbf9ce4..2bef6c2 100644 --- "a/data/2.MySQL\344\270\255\351\230\266/4.\350\201\232\345\220\210\345\222\214\345\210\206\347\273\204/3.\346\234\200\345\260\217\345\200\274/min.md" +++ "b/data/2.MySQL\344\270\255\351\230\266/4.\350\201\232\345\220\210\345\222\214\345\210\206\347\273\204/3.\346\234\200\345\260\217\345\200\274/min.md" @@ -38,17 +38,11 @@ select dept, min(salary) from employee; ### B ```sql -select dept, min(salary) from employee; +select dept, min(salary) from employee order by dept; ``` ### C -```sql -select dept, min(salary) from employee; -``` - -### D - ```sql select dept, min(total) from employee; ``` \ No newline at end of file diff --git "a/data/2.MySQL\344\270\255\351\230\266/4.\350\201\232\345\220\210\345\222\214\345\210\206\347\273\204/5. \345\271\263\345\235\207\345\200\274/avg.md" "b/data/2.MySQL\344\270\255\351\230\266/4.\350\201\232\345\220\210\345\222\214\345\210\206\347\273\204/5. \345\271\263\345\235\207\345\200\274/avg.md" index 35dcd6b..9bec946 100644 --- "a/data/2.MySQL\344\270\255\351\230\266/4.\350\201\232\345\220\210\345\222\214\345\210\206\347\273\204/5. \345\271\263\345\235\207\345\200\274/avg.md" +++ "b/data/2.MySQL\344\270\255\351\230\266/4.\350\201\232\345\220\210\345\222\214\345\210\206\347\273\204/5. \345\271\263\345\235\207\345\200\274/avg.md" @@ -38,17 +38,11 @@ select dept, avg(salary) from employee; ### B ```sql -select dept, avg(salary) from employee; +select dept, avg(dept) from employee group by dept; ``` ### C ```sql -select dept, avg(salary) from employee; +select dept, avg(salary) from employee group by salary; ``` - -### D - -```sql -select dept, avg(salary) from employee ; -``` \ No newline at end of file diff --git "a/data/2.MySQL\344\270\255\351\230\266/7. \347\264\242\345\274\225/2.\345\210\233\345\273\272\347\264\242\345\274\225/create_index.md" "b/data/2.MySQL\344\270\255\351\230\266/7. \347\264\242\345\274\225/2.\345\210\233\345\273\272\347\264\242\345\274\225/create_index.md" index abfe688..082df2f 100644 --- "a/data/2.MySQL\344\270\255\351\230\266/7. \347\264\242\345\274\225/2.\345\210\233\345\273\272\347\264\242\345\274\225/create_index.md" +++ "b/data/2.MySQL\344\270\255\351\230\266/7. \347\264\242\345\274\225/2.\345\210\233\345\273\272\347\264\242\345\274\225/create_index.md" @@ -41,7 +41,7 @@ create unique index idx_goods_category on goods(category_id); ### B ```sql -create index idx_goods_category on goods(category_id); +create index idx_goods_category on goods(name); ``` ### C -- GitLab