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
wilfredo casas
555 PointsWhat'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?
6 Answers
Patrick Timbo
331 PointsHello 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/
Josh Alling
17,172 PointsTry putting your dates between single quotes
jeremiahjacquet
17,043 PointsYour 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.
Rafael silva
23,877 Pointsthansk a lot for this explanation, you're great!
beatagozdziaszek
9,945 Points"2015-09-01 " and "2015-09-30" It can be both, double and single quotes.
Masango Dewheretsoko
19,661 PointsHie 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
FLORENCE UWAKWE
Data Analysis Techdegree Student 671 PointsThis should work, just make sure not to add extra space .... SELECT * FROM results WHERE played_on BETWEEN "2015-09-01" AND "2015-09-30";
Calvin . T Rupango
6,083 PointsCalvin . T Rupango
6,083 PointsThe 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.