[ACCEPTED]-*= in Sybase SQL-sybase

Accepted answer
Score: 14

From http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.dc34982_1500/html/mig_gde/mig_gde160.htm:

Inner and outer tables

The terms outer 12 table and inner table describe the placement 11 of the tables in an outer join:

  • In a left 10 join, the outer table and inner table are 9 the left and right tables respectively. The 8 outer table and inner table are also referred 7 to as the row-preserving and null-supplying 6 tables, respectively.

  • In a right join, the 5 outer table and inner table are the right 4 and left tables respectively.

For example, in 3 the queries below, T1 is the outer table 2 and T2 is the inner table:

  • T1 left join T2
  • T2 right join T1

Or, using Transact-SQL 1 syntax:

  • T1 *= T2
  • T2 =* T1
Score: 9

It means outer join, a simple = means inner 3 join.

*= is LEFT JOIN and =* is RIGHT JOIN.

(or vice versa, I keep forgetting since 2 I'm not using it any more, and Google isn't 1 helpful when searching for *=)

Score: 6

Of course, you should write it this way:

SELECT *
FROM a
LEFT JOIN b ON b.id=a.id

The a,b 1 syntax is evil.

Score: 5

ANSI-82 syntax

select 
    * 
from 
    a
  , b 

where 
     a.id *= b.id

ANSI-92

select 
    * 
from 
   a
  left outer join b 
      on a.id = b.id

0

Score: 1
select * from a, b where a.id = b.id

Requires that a row exist in where b.id 3 = a.id in order to return an answer

select * from a, b where a.id *= b.id

Will 2 fill the columns from b with nulls when 1 there wasn't a row in b where b.id = a.id.

More Related questions