Home > OS >  How can I list all the information in the SQL Query
How can I list all the information in the SQL Query

Time:12-01

Can I ask how can I list the department, course, and section for all 4-credit courses offered by the CIS department.

SELECT * FROM classes WHERE credit LIKE '4' AND LIKE 'CIS';

CodePudding user response:

This statement means it has to meet both conditions the 4% and CIS%

SELECT * FROM classes WHERE credit LIKE '4%' AND LIKE 'CIS%'

This statement means it has to meet either condition the 4% or CIS%

SELECT * FROM classes WHERE credit LIKE '4%' OR LIKE 'CIS%'

the like conditions require a % to match what its suppose to be like, the % after the 4 and CIS means that it should look for anything that starts with 4 or CIS

%4% || %CIS% the percentage on each end in this case would mean that what your looking for contains 4 or CIS

C%IS and this means that its would start with a C and end with IS.

Hope this helps a bit.

  • Related