Viewing SELECT Statement Syntax

The SELECT statement and its subordinate clauses are the building blocks for constructing all PROC SQL queries.
General form, SELECT statement:
SELECT column-1<, ... column-n>
FROM table-1 | view-1<, ... table-n | view-n>
<WHERE expression>
<GROUP BY column-1<, ... column-n>>
<HAVING expression>
<ORDER BY column-1<, ... column-n>>;
Here is an explanation of the syntax:
SELECT
specifies the column(s) that appear in the output
FROM
specifies the table(s) or view(s) to be queried
WHERE
uses an expression to subset or restrict the data based on one or more condition(s)
GROUP BY
classifies the data into groups based on the specified column(s)
HAVING
uses an expression to subset or restrict groups of data based on group condition(s)
ORDER BY
sorts the rows that the query returns by the value(s) of the specified column(s).
Note: The clauses in a PROC SQL SELECT statement must be specified in the order shown.
You should be familiar with all of the SELECT statement clauses except for the HAVING clause. The use of the HAVING clause is presented later in this chapter.
Now, we look at some ways that you can limit and subset the number of columns that are displayed in query output.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.117.233