To run the examples:
Suppose table a has columns a1,a2,a3,...; and table b has columns b1,b2,b3,...; a1 and b1 are keys which specify unique rows in a and b respectively.
An inner join with a1=b1 gives a combined table with columns (a1=b1),a2,a3,...,b2,b3,... from matching rows occurring in both a and b. Partially empty rows, from rows occurring in only one of the input tables, are excluded.
Example:
splus
options(echo=T)
source ("a.s")
source ("b.s")
source ("inner.s")
a
b
inner.join(a,b)
q()
Suppose table a has columns a1,a2,a3,...; and table b has columns b1,b2,b3,...; a1 and b1 are keys which specify unique rows in a and b respectively.
An outer join with a1=b1 gives a combined table with columns (a1=b1),a2,a3,...,b2,b3,... from rows occurring in either a and b. Partially empty rows, from rows occurring in only one of the input tables, are included.
Example:
splus
options(echo=T)
source ("a.s")
source ("b.s")
source ("outer.s")
a
b
outer.join(a,b)
q()
Suppose table a has columns a1,a2,a3,...; table b has columns b1,b2,b3,...; a1 is any column in a; b1 is a key which specifies a unique rows in a and b.
A left outer join with a1=b1 gives a combined table with columns (a1=b1),a2,a3,...,b2,b3,... The combined rows correspond to the rows of a. In each combined row, values of b2,b3,... are taken from the row in b whose key value b1 matches the value of column a1. Rows in b which do not match rows in a are ignored.
Example:
splus
options(echo=T)
source ("d.s")
source ("b.s")
source ("leftouter.s")
d
b
leftouter(d,b,2)
q()