TurboSQL Guide Table Operators |
Previous Top Next |

TurboSQL supports the following operators to combine table rows. They all follow the standard SQL specification:

JOIN

Syntax

table_reference [INNER | LEFT OUTER | RIGHT OUTER | OUTER] JOIN table_reference

Samples

SELECT * FROM A JOIN B ON A.a = B.a

SELECT * FROM A LEFT OUTER JOIN B ON A.a = B.a

Description

Returns all row pairs of the two table references, for which the join condition holds.

UNION

Syntax

table_term UNION [ALL] table_term [CORRESPONDING BY column_list]

Samples

SELECT * FROM TABLE A UNION SELECT * FROM TABLE B

Description

Returns all rows from the two table terms. The result set is unique if all is not specified. The two table terms must have compatible columns.

EXCEPT

Syntax

table_term EXCEPT [ALL] table_term CORRESPPONDING [BY column_list]

Samples

SELECT * FROM TABLE A EXCEPT SELECT * FROM TABLE B

Description

Returns all rows from the first table term that do not exist in the second one. The result set is unique if all is not specified. The two table terms must have compatible columns.

INTERSECT

Syntax

table_primitive INTERSECT table_primitive CORRESPONDING [BY column_list]

Samples

SELECT * FROM TABLE A INTERSECT [ALL] SELECT * FROM TABLE B

Description

Returns all rows that exist in both the first and the second table term. The result set is unique if all is not specified. The two table terms must have compatible columns.