Answer the following SQL questions- I am new in SQL

Hello everyone.

I started an SQL course in Coursera called SQL for Data Science and I have been stuck in some programing questions. I will really appreciate your feedback.

This is the exercise:

And this is the question:

Question 5: What is the pay type for all the job codes that start with '03'? The code has been started for you, but you will need to program the fourth and fifth lines yourself before running the query.

I wrote the following code, but a syntax error appears:

Select
Job_Code,
Pay_Type,
From salary_range_by_job_classification
WHERE Job_Code LIKE '03%'

near "From": syntax error

I will really appreciate your feedback.

Best regards.

Not sure how folks feel about doing homework for people, but your error message telling you pretty much where your error is.

SQL syntax has commas between selected items, but your last selected column doesn't have anything behind it so there's no need for a comma there.

Pay_Type shouldn't have a comma after it.

Thank you very much. I appreciate your help.

If you feel uncomfortable answering this kind of questions to someone who is new in this field because you are "doing homework for people", next time, you don't have to answer.

Best regards.

wow, a thank you is all that is needed. No need for that type of response.

1 Like

If the person requesting the help has shown their work - shown where they are stuck - and has asked for help identifying the issue, then I see no problem with giving directions.

I personally don't want to just give someone the answer to homework questions - rather I want to guide that person to the solution.

In this case - the OP posted the question for context...posted their solution and asked for help identifying the problem. Nothing wrong with that - really just a second pair of eyes...

Yes, you are completely right, however, it is not nice to say that you someone is doing other's people homework just because he is asking something that doesn't know. I tried many ways but I couldn't get the answer. I didn't really know what to do so that is why I asked, not because I wanted my homework to be done by someone else. It is not a good way to motivate people to use this kind of tools to ask questions specially when they are new in this kind of spaces like me.

Once again, thank you very much for your answer, it was really helpful.

Thank you.

Select

Job_Code,

Pay_Type

from salary_range_by_job_classification

where Job_Code like '%03%'

use this Query

That part is not correct for the defined problem. That code will find any job code that has a "03" in it anywhere. The problem said that the job code must START with a "03" and so the WHERE clause should not contain the leading wild-card.

1 Like