Here is the database I'm using: https://drive.google.com/file/d/1ArJekOQpal0JFIr1h3NXYcFVngnCNUxg/view?usp=sharing
List the deptnum and total number of academics for CS departments, in alphabetical order of deptname. CS departments are departments whose deptname contains the phrase "Computer ... Science" or “Computing … Science” in upper case or lower case letters. You must use the NATURAL JOIN operator.
My attempt at this question:
SELECT deptnum
FROM academic NATURAL JOIN department
WHERE UPPER(deptname) LIKE ('%computer science%') OR UPPER(deptname) LIKE
('%computing science%')
ORDER BY deptnum;
It keeps coming up with no values, I'm not sure what I'm doing wrong.
Thank you
EDIT:
Thanks everyone. This is what I'm using now (although inefficient):
SELECT distinct deptnum
FROM academic NATURAL JOIN department
WHERE UPPER(deptname) LIKE ('%COMPUTER%') AND UPPER(deptname) LIKE
('%SCIENCE%')OR UPPER(deptname) LIKE ('%COMPUTING%') AND UPPER(deptname)
LIKE ('%SCIENCE%')
ORDER BY deptnum;
The
LIKE
operator in MySQL is already case insensitive, so the following should work:We can tidy this up a bit by using
REGEXP
, which is also case insensitive: