The
Documentation[
^] would seem an obvious place to start?
<br />
If exists(query) then<br />
update something<br />
select something<br />
else if not exists(query) then<br />
insert something<br />
select something<br />
end if<br />
end if<br />