Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

What's wrong with my SQL?

We're back in our sports team database with the results table. The columns are id, home_team, home_score, away_team, away_score and played_on. There are 30 days in September. Find all the games played in the results table in September 2015.

'SELECT * FROM results WHERE played_on BETWEEN 2015-09-01 and 2015-10-01'

What is wrong with it?

The first thing about your code is the absence of quotes on the dates on your answer as dates can be represented with double quotes. Secondly the AND is suppose to be presented in caps as the challenge is really sensitive on those and lastly the date is suppose to be up to the end of the month of September as the max attribute.

You can try this solution.

'SELECT * FROM results WHERE played_on BETWEEN "2015-09-01" AND "2015-09-30";

I just hope it will work.

6 Answers

Hello there,

I just wanted to clarify something. Are you including the ' symbol before and after the entire statement? If so, the syntax is incorrect. Remove those symbols and you should be go to good. There is no visible issue other than that with the syntax of your sql query.vv

Also here is a tool you can use to check your syntax https://www.piliapp.com/mysql-syntax-check/

Try putting your dates between single quotes

Your values have to be in double quotes and the instructions mention that there are 30 days in September and nothing mentioning October. Adjust your dates from 1 to 30 within the month values.

thansk a lot for this explanation, you're great!

"2015-09-01 " and "2015-09-30" It can be both, double and single quotes.

Hie Wilfredo Casas try the following, it will help you SELECT * FROM results WHERE played_on BETWEEN "2015-09-01" and "2015-09-30"; !Happy Coding

This should work, just make sure not to add extra space .... SELECT * FROM results WHERE played_on BETWEEN "2015-09-01" AND "2015-09-30";