Show TOC Start of Content Area

Syntax documentationFROM Clause  Locate the document in its SAP Library structure

The FROM clause is used to construct a result table from a database table or from a join of database tables.

Syntax

Syntax

<from clause> ::= FROM <table specification>

                             ( ',<table specification> )*.

 

<table specification> ::= <table reference>

                                       | <joined table>.

 

The result of a <from clause> is the extended Cartesian product (ECP) of the <table specification>s in the <from clause>. The ECP of two <table specification>s (A, B) is constructed as follows:

Every row from A is concatenated with every row from B. The cardinality of ECP is the product of the cardinalities of A and B, the degree of ECP is the sum of the degrees of A and B.

Table A:

column1

column2

1

a

2

a

 

Table B:

column1

column2

1

b

2

b

 

ECP:

A.column1

A.column2

B.column1

B.column2

1

A

1

B

1

A

2

B

2

A

1

B

2

A

2

B

 

If only one <table specification> is specified the result of the <from clause> is this <table specification>.

Example

Example

SELECT employee_name, manager_name
    FROM employees AS e, managers AS m
    WHERE e.manager_id = m.manager_id

The FROM Clause.  This query produces a list of all employees that have a manager along with their respective managers. Here, the FROM clause contains a list of two table references, each having a table alias.

End of Content Area