0

I am trying to get the job and the deptno 30 from the table but I get an error. Any idea what I am missing?

SQL> select deptno from emp where deptno 30;
select deptno from emp where deptno 30
                                *
ERROR at line 1:
ORA-00920: invalid relational operator

Table

SQL> select empno, ename, job, mgr, hiredate,comm, deptno from emp;

 EMPNO ENAME      JOB              MGR HIREDATE        COMM     DEPTNO
 ---------- ---------- --------- ---------- --------- ---------- ----------
  7839 KING       PRESIDENT            17-NOV-81                    10
  7698 BLAKE      MANAGER         7839 01-MAY-81                    30
  7782 CLARK      MANAGER         7839 09-JUN-81                    10
  7566 JONES      MANAGER         7839 02-APR-81                    20
  7654 MARTIN     SALESMAN        7698 28-SEP-81       1400         30
  7499 ALLEN      SALESMAN        7698 20-FEB-81        300         30
  7844 TURNER     SALESMAN        7698 08-SEP-81          0         30
  7900 JAMES      CLERK           7698 03-DEC-81                    30
  7521 WARD       SALESMAN        7698 22-FEB-81        500         30
  7902 FORD       ANALYST         7566 03-DEC-81                    20
  7369 SMITH      CLERK           7902 17-DEC-80                    20

 EMPNO ENAME      JOB              MGR HIREDATE        COMM     DEPTNO
 ---------- ---------- --------- ---------- --------- ---------- ----------
  7788 SCOTT      ANALYST         7566 09-DEC-82                    20
  7876 ADAMS      CLERK           7788 12-JAN-83                    20
  7934 MILLER     CLERK           7782 23-JAN-82                    10

 14 rows selected.
2
  • 1
    Query doesn't make a whole lot of sense either. If you are selecting the deptno where deptno=30 you know for a fact that all you'll get back are rows saying 30 (if any exist). Commented Sep 15, 2011 at 1:57
  • It was something stupid I missed thanks for putting up with my stupid question Commented Sep 15, 2011 at 1:58

1 Answer 1

4

Are you missing the comparison operator (=)?

select deptno from emp where deptno=30
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.