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 641180d4901d7df12f64d82db53599ec40f4ec53..c8577bd20cdd450231d13d5f91401684e66f2ce8 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 bbf9ce444d24b5e63e910d5a7f8fc5d50b5875ac..2bef6c26aa5d0dab75217da64db9715628614ca3 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 35dcd6bf934210257d6840733ef6615c4c6aeea1..9bec946de9e46b326c695a5d5563c1a979709c59 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 abfe688f17cdaaa3e53fcbea29d83f78a47a4e7f..082df2f1d9c48f1add4028d25f4f5a366e104859 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