SQL statement Execution Order
1.from clauses assemble data from different data sources
The 2.where clause filters the record rows based on the specified criteria
The 3.group by clause divides data into multiple groupings
4. Using aggregation functions for calculations
5. Filtering groupings using the HAVING clause
6. Calculate All expressions
Field of 7.select
8. Use order by to sort the result set
SQL Statement Parsing order
1. Table name and condition field are incorrectly written
SELECT * from Sysuser where username= ' abc '
Result: ORA-00942: Table or view does not exist
2. Condition fields and query columns are incorrectly written
Select UserID from Sys_user where Username= ' abc '
Result: ORA-00904: "USERNAME": Invalid identifier
3. Query fields and GROUP BY statements are incorrectly written
Select UserID from Sys_user where User_name= ' abc ' GROUP BY username
Result: ORA-00904: "USERNAME": Invalid identifier
4. The query field and the order by field are incorrectly written
Select UserID from Sys_user where user_name= ' abc ' ORDER BY username
Result: ORA-00904: "USERNAME": Invalid identifier
5.group by and order by fields are incorrectly written
Select user_id from Sys_user where User_name= ' abc ' GROUP BY username order by UserID
Result: ORA-00904: "USERID": Invalid identifier
6.join and where field is incorrectly written
Select A.* from
(SELECT * from Sys_user) a
Left Join
(SELECT * from Sys_user) b
On (a.userid=b.user_id)
where A.username= ' abc '
Result: ORA-00904: "A". " USERID ": Invalid identifier
SQL statement parsing order and execution order