UP | HOME

Basic Understanding of SELECT statement

1. The syntax

SELECT [ DISTINCT | ALL ] { * | <select list> }
FROM <table reference> [ { , <table reference> } . . . ]
[ WHERE <search condition> ]
[ GROUP BY <grouping specification> ]
[ HAVING <search condition> ]
[ ORDER BY <order condition> ]

2. The evaluation

  • FROM clause
  • WHERE clause (optional)
  • GROUP BY clause (optional)
  • HAVING clause (optional)
  • SELECT clause
  • ORDER BY clause (optional)