devxlogo

IN SQL Statement

IN SQL Statement

Question:
I have department codes like this: T, B, P, O, Q, etc. How can I find T only, B only, or others only (excluding T and B)?

Answer:
You can achieve this by using the IN statement. You could say:

 WHERE Department NOT IN ( 'T', 'B' )

devx-admin

Share the Post: