Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: a easy SQL question?

Re: a easy SQL question?

From: Chris Nelson <wrhs_71_at_yahoo.com>
Date: 2000/02/18
Message-ID: <5m5r4.5163$bz2.970022@tw12.nn.bcandid.com>#1/1

Posted and emailed...

Another way to accomplish the same thing is: WHERE SUBSTR( deptno, 1, 1) NOT IN ('R', 'X')

I think you might want to reconsider your database structure, too, by the way. Another of your respondents already alluded to this.

It would seem to me that an employee would have a (single) department number assigned, so dept_num seems to be an appropriate field in the EMPLOYEE table. The way you have it set up now, it would be possible to assign an employee to multiple departments, unless you set up special coding to preclude the possibility. You can avoid the coding if you just have a single dept_num field in the EMPLOYEE table.

Also, do you want to have to edit the entire DEPARTMENT whenever you have personnel changes? You'd be editing DEPARTMENTs all day, when all you really want to edit is an EMPLOYEE or two. (For example, an employee transfer from one department to another would require that you edit two records in your setup.)

Chris

<yliu_at_creighton.edu> wrote in message
news:Pine.HPP.3.95.1000217144949.23009B-100000_at_penguin.creighton.edu...
> Hi All,
>
> I have a table called dept. Two of the fields in dept table is emp_name
> and deptno. I want to select every emp_name from dept table except for two
> deptno (R% and X%). I am confused on which operator to use: OR or AND.
> My SQL statement is like:
> select emp_name, deptno
> from dept
> where ...
> and (deptno not like X% or deptno not like R%)
> and ...;
>
> However, I don't know if I should use AND in the above where clause?
> Maybe somebody has some suggestions that will clear my confusion.
>
> Thanks in advance for helping.
>
> Yong
> yliu_at_creighton.edu
>
Received on Fri Feb 18 2000 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US