sqlitecoursera-api

have a question in sql in coursera. the following code is showing an error


question-Write and run a query, with no starter code or hints to answer this question: What is the step for Union Code 990 and a Set ID of SFMTA or COMMN? name of the table- salary_range_by_job_classification my answer code-

SELECT STEP,Union_Code,Set-ID
from salary_range_by_job_classification
where (Union_Code=990) and 
(SetID='SFMTA' or 'COMMN')

Solution

  • You are pretty close. Change your query to:

    SELECT STEP, Union_Code, SetID
    from salary_range_by_job_classification
    where Union_Code=990 and SetID in ('SFMTA', 'COMMN')
    

    You can also write it like so:

    SELECT STEP, Union_Code, SetID
    from salary_range_by_job_classification
    where Union_Code=990 and (SetID = 'SFMTA' or SetID = 'COMMN')
    

    Just make sure you are using the column names correctly, consistently.