The six main clauses of the SELECT command are shown in the following table.
Component | Description |
---|---|
FROM | table(s) is (are) needed for retrieval |
WHERE | the condition to filter the rows |
GROUP BY | how to group the rows |
HAVING | the condition to filter the aggregated groups? |
SELECT | columns in the result |
ORDER BY | sort resulting rows |
With the SELECT clause of a SELECT command statement, you specify the columns that you want to be displayed in the query result.
WHERE clause allows you to formulate conditions that must be true in order for a row to be retrieved.
You can use various operators in your WHERE clause conditions-such as BETWEEN, LIKE, IN, CASE, NOT, AND, and OR.
With the ORDER BY clause, you specify the order in which you want to see the rows sorted in the result of your queries.
FROM clause allows you to specify which tables you want to access.