SQL components to specify sorting, displaying, grouping
SQL Statement | Syntax | Example Statement | Example Result or Description |
AS (alias) |
SELECT column_name AS column_alias FROM table_name or SELECT column_name FROM table_name AS table_alias |
select Carrier, count(*) as Count from device group by Carrier |
Use AS if you want to provide a different label for a column in the report results. |
GROUP BY |
SELECT Carrier, count(*) AS Count from device GROUP BY Carrier |
select Carrier, count(*) as Count from device group by Carrier |
Use GROUP BY to organize the report results by a specified column value. |
ORDER BY |
SELECT column_name(s) FROM table_name ORDER BY column_name [ASC|DESC] |
select Name, Count(*) as Count from InstalledApp group by name order by count desc |
Use SORT BY to sort the report results by a specified column value. |