Skip to content

Commit

Permalink
Merge pull request #144 from SwanSpouse/database
Browse files Browse the repository at this point in the history
#65 sql exec order
  • Loading branch information
SwanSpouse committed Jun 9, 2018
2 parents a86a534 + b768532 commit 0aa1def
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ Redis原始源码来自: https://github.com/antirez/redis
* [hash code](https://github.com/SwanSpouse/redis_go/blob/master/z_docs/framework/hash_code.md)
* [new redis go server model](https://github.com/SwanSpouse/redis_go/blob/master/z_docs/framework/redis_go_server_model.md)


#### 数据库
* [数据库事务](https://github.com/SwanSpouse/redis_go/blob/master/z_docs/database/db_transaction.md)
* [数据库锁和索引](https://github.com/SwanSpouse/redis_go/blob/master/z_docs/database/database_index.md)
* [数据库SQL语句执行顺序](https://github.com/SwanSpouse/redis_go/blob/master/z_docs/database/database_sql_order.md)

#### data type
* [Hash表实现](https://github.com/SwanSpouse/redis_go/blob/master/z_docs/data_type/redis_go_dict.md)
Expand Down
21 changes: 21 additions & 0 deletions z_docs/database/database_sql_order.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@


#### SQL语句执行顺序

查询中用到的关键词主要包含六个,并且他们的顺序依次为:

* select --> from --> where --> group by --> having --> order by

SQL Select语句完整的执行顺序【从DBMS使用者角度】:

1. from:需要从哪个数据表检索数据

2. where:过滤表中数据的条件

3. group by:如何将上面过滤出的数据分组

4. having:对上面已经分组的数据进行过滤的条件

5. select:查看结果集中的哪个列,或列的计算结果

6. order by :按照什么样的顺序来查看返回的数据

0 comments on commit 0aa1def

Please sign in to comment.