-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from SwanSpouse/database
#65 sql exec order
- Loading branch information
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 :按照什么样的顺序来查看返回的数据 |