#!/bin/sh
#
# Test joins
# 

SHSQL="shsql -echo -h -delim space"
echo "-------------------------------------------------------------"
echo "1. inner join vs. right join (in this case, should give same results)"
$SHSQL "select j.pmid, j.authorlist, j.title, c.pubtype, c.tabdata
	from journalcits (as j) inner join curcits (as c) 
	on j.pmid = c.pmid 
	where j.authorlist like '*smith*' 
	order by j.pmid num"  					2>&1

$SHSQL "select j.pmid, j.authorlist, j.title, c.pubtype, c.tabdata
	from journalcits (as j) right join curcits (as c) 
	on j.pmid = c.pmid 
	where j.authorlist like '*smith*' 
	order by j.pmid num"  					2>&1



echo "-------------------------------------------------------------"
echo "2. outer join vs. left join (in this case, should give same results)"
$SHSQL "select j.pmid, j.authorlist, j.title, c.pubtype, c.tabdata
	from journalcits (as j) outer join curcits (as c) 
	on j.pmid = c.pmid 
	where j.authorlist like '*smith*' 
	order by j.pmid num"  					2>&1

$SHSQL "select j.pmid, j.authorlist, j.title, c.pubtype, c.tabdata
	from journalcits (as j) left join curcits (as c) 
	on j.pmid = c.pmid 
	where j.authorlist like '*smith*' 
	order by j.pmid num"  					2>&1
