| Start | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Basic SELECT from table Select all columns from some table (system table in this case): Or, select just some specific columns: |
||||||||||||
| Filter rows using WHERE clause WHERE clause filters only those rows that satisfy some condition: |
||||||||||||
| Sort results using ORDER BY ORDER BY clause sorts rows in the returned result set by some column or expression: |
||||||||||||
| Group result using GROUP BY GROUP BY clause groups rows by some value: You can apply some function on each group (aggregate function) to calculate sum or count of the records in the group.
|
||||||||||||
| Filter groups using HAVING clause HAVING clause removes groups that do not satisfy condition:
|
||||||||||||
| Returning only first N rows TOP clause returns only first N rows in the result: |
||||||||||||
| Pagination using OFFSET FETCH OFFSET FETCH clause is more advanced version of TOP. It enables you to skip N1 rows and take next N2 rows: You can use OFFSET without fetch to just skip first 50 rows: |
||||||||||||
| SELECT without FROM (no data souce) SELECT statement can be executed without FROM clause: In this case, one row with values/results of expressions are returned. |
Read Article
https://develop.horje.com/learn/1434/reference