Entering content frame

Syntax documentation SELECT Statement Locate the document in its SAP Library structure

A SELECT statement allows retrieving data from the database. Technically, it is a query with an optional clause for ordering the results. The query is either a query specification or a union of query specifications. The result of a SELECT statement is a result set.

Syntax

This graphic is explained in the accompanying text

<select statement> ::= <query> ( <order by clause> )?.

 

<query>  ::= <query specification>

                    | <query expression>

 

Examples

Example

SELECT * FROM employees

A Simple SELECT Statement. This SELECT statement selects all columns from the table employees.

Example

SELECT empid AS employee_id, last_name,salary

                         FROM employees

                         WHERE salary>5000

                         ORDER BY empid

A SELECT Statement. This SELECT statement selects data from the columns empid, last_name and salary from the table employees. The statement selects only the employees whose salary is greater than 5,000. In the result table the data from the empid column is presented in a column named EMPLOYEE_ID. The results are sorted by employee ID in ascending order.

See

Query Specification

FROM Clause

Joined Table

Table Reference

WHERE Clause

GROUP BY Clause

HAVING Clause

Select List

UNION

ORDER BY Clause

 

Leaving content frame