You are here

DQL

CROSS JOIN - kartesian product

Syntax

    SELECT {Table1|Alias1}.Field1 [,...] , {Table2|Alias2}.Field2 [,...]
    FROM Table1 [Alias1], Table2 [Alias2]

    before SQL92 (no join declaration at all)

    FROM Table1 [Alias1] CROSS JOIN Table2 [Alias2]
    SQL92 (explicit declaration of a cross join)

Categories: 

FULL JOIN - two sided outer join

Syntax

    FROM Table1 [Alias1] FULL JOIN Table2 [Alias2] ON {Table1|Alias1}.Field1 = {Table2|Alias2}.Field2
    SQL92 (explicit declaration of a full or union join)

    SELECT Fieldlist FROM Table1 [Alias1] LEFT JOIN Table2 [Alias2] ON {Table1|Alias1}.Field1 = {Table2|Alias2}.Field2 UNION
    SELECT Fieldlist FROM Table1 [Alias1] RIGHT JOIN Table2 [Alias2] ON {Table1|Alias1}.Field1 = {Table2|Alias2}.Field2

    SQL92 (if a direct declaration of a full or union join is not supported by the database system)

Categories: 

RIGHT JOIN - right outer join

Syntax

    FROM OUTER Table1 [Alias1], Table2 [Alias2]
    WHERE a.Field1 = b.Field2

    Informix, before SQL92 (implicit join declaration)

    WHERE (a.Field1(+) = b.Field2)
    Oracle, before SQL92 (implicit join declaration)

Categories: 

LEFT JOIN - left outer join

Syntax

    FROM Table1 [Alias1], OUTER Table2 [Alias2]
    WHERE a.Field1 = b.Field2

    Informix, before SQL92 (implicit declaration of table join)

    WHERE (a.Field1 = b.Field2(+))
    Oracle, before SQL92 (implicit declaration of table join)

Categories: 

INNER JOIN - normal table join

Syntax

    WHERE a.Field1 = b.Field2
    before SQL92 (implicit declaration of table joins)

    FROM Table1 [Alias1] INNER JOIN Table2 [Alias2] ON {Table1|Alias1}.TableKey = {Table2|Alias2}.TableKey
    SQL92 (explicit declaration of table joins)

Description

Categories: 

SELECT - step by step

The SQL command for querying data in a database is very powerfull and therefore can be quite complex. To adres sthat problem I provide here a small step by step tutorial how to build a SELECT command. May be it is easier for you to answer the following questions and to build so your custom SELECT command step by step:

Categories: 
Subscribe to RSS - DQL