Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Joins
BigLearner wrote:
> Dear buddies,
>
> I am a new member to this group.
>
> Looking forward to build up myself towards future.
>
> I have a doubt on joins.
>
> select e.empno, e.ename, d.loc
> from emp e, dept d
> where e.deptno = d.deptno
> and substr(e.ename,1,1) = 'S';
>
> How can I rewrite it in ANSI compliant equivalent statement usable on
> the Oracle database?
>
> select empno, ename, loc
> from emp join dept
> on emp.deptno = dept.deptno
> where substr(emp.ename,1,1) = 'S';
>
> or
>
> select empno, ename, loc
> from emp join dept
> on emp.deptno = dept.deptno
> and substr(emp.ename,1,1) = 'S';
>
> Which one of them is right, using where or and for the last condition?
>
> Do guide me.
>
> Thanks.
>
> BigLearner
All three queries are compliant with ANSI and ISO SQL92 and later versions. (Except for SUBSTR function. The ANSI equivalent is SUBSTRING). The results are the same in each case.
-- David PortasReceived on Sat Dec 02 2006 - 02:04:38 CST