This will display sales rep's names, and their territory.
It will also display names that do not have a territory.
1> select t1.srep_name, t2.terr_name
2> from salesrep t1, territory t2
3> where t1.srep_id *= t2.srep_id
4> go
srep_name terr_name
-------------------- --------------------
Jim Smith Wisconsin
Jake Blues Rhode Island
Fred Green New York
Sam Jones Illinois
Rob Trent Florida
Sally Sales NULL
Mary Market NULL
Now, this will display all territories,
even those that have no salesman assigned ...
1> select t1.srep_name, t2.terr_name
from salesrep t1, territory t2
where t1.srep_id =* t2.srep_id
2> 3> 4>
5> go
srep_name terr_name
-------------------- --------------------
Jim Smith Wisconsin
Jake Blues Rhode Island
Fred Green New York
Sam Jones Illinois
Rob Trent Florida
NULL California
NULL Washington
And this, of course, will display
only salesreps and territories for which
there is a link ...
select t1.name, t2.territory_name
from salesrep t1, territory t2
where t1.srep_id = t2.srep_id
1>
2> select t1.srep_name, t2.terr_name
3> from salesrep t1, territory t2
4> where t1.srep_id = t2.srep_id
5> go
srep_name terr_name
-------------------- --------------------
Jim Smith Wisconsin
Jake Blues Rhode Island
Fred Green New York
Sam Jones Illinois
Rob Trent Florida
|
|