SELECT FROM TWO TABLES:  SYNTAX 

 

(Recommended, ANSI-style)

 

            SELECT column list

            FROM tablename1

                        INNER JOIN tablename2

                        ON tablename1.col1=tablename2.col2

            WHERE criteria

            ORDER BY column list

 

(Older, theta-style)

 

            SELECT column list

            FROM tablename1, tablename2

            WHERE tablename1.col1=tablename2.col2

            AND other criteria

            ORDER BY column list

           

- col1 in tablename1 is usually that table's primary key

- col2 in tablename2 is a foreign key in that table

- col1 and col2 must have the same data type and for certain data types, the same size