SAS
SAS Data Sets
SELECT Statements
A SELECT statement can consist of the following basic clauses.
SELECT
INTO
FROM
JOIN
WHERE
GROUP BY
HAVING
UNION
ORDER BY
LIMIT
SELECT Syntax
The following syntax diagram outlines the syntax supported by the SQL engine of the provider:
|
Examples
Return all columns:
SELECT * FROM Account
Rename a column:
SELECT [Name] AS MY_Name FROM Account
Cast a column's data as a different data type:
SELECT CAST(AnnualRevenue AS VARCHAR) AS Str_AnnualRevenue FROM Account
Search data:
SELECT * FROM Account WHERE Industry = 'Floppy Disks'
Parameterize a query to pass in inputs at execution time. This enables you to create prepared statements and mitigate SQL injection attacks.
SELECT * FROM Account WHERE Industry = @param
Last updated