1

Basically, I have a DEPARTMENT table with each department having a deptname. I want to grab the deptnum of all departments with the words "Computer ... Science" in their name. It doesn't matter if there are words in between only if they have those two words in the name.

Any ideas of what I should put in my where statement to do this?

1 Answer 1

1

You could use the like operator:

SELECT *
FROM   department
WHERE  deptname LIKE '%Computer%Science%'
Sign up to request clarification or add additional context in comments.

3 Comments

Does that allow for words to be inbetween?
Yes, allows for in between (and words before Computer, and words after Science), but the string Computer must be before Science.
@Joshm102 '%' is a wildcard in the like operator. So basically, this query looks for deptnames that are made up of any string (could be empty!), followed by Computer, followed by any string (again - can be empty, can be a couple of words, can be whatever), followed by Science, followed by any string again.

Your Answer

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