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 trialOskar Pihlak
2,094 PointsSTRFTIME() function
In a movies database we have a movies table. It has the columns of id, title, date_released and genre. Write a query that returns the title first and the month and year it was released alias as month_year_released. Dates should look like "04/1983" for April 1983.
Bummer! There's something wrong with your SQL statement. Please review your code and try again.
SELECT, STRFTIME( %m/ %Y, title) AS month_year_released FROM movies;
Can anyone help please ? :)
2 Answers
Rob Anderton
304 PointsYou've missed out the title
field (perhaps the reason for the rogue comma?), but have put the title
field in the call to STRFTIME
when it should be date_released
, and the format specifier should be in quotes.
Something like this might just do it:
SELECT title, STRFTIME('%m/%Y', date_released) AS month_year_released FROM movies;
Alexander Davison
65,469 PointsWhy is there a comma right after SELECT
?
Maybe removing that will help.
Good luck! ~alex
Oskar Pihlak
2,094 PointsThank you but didn`t fix the error. Still there.
Alexander Davison
65,469 PointsCan you provide a link to the code challenge? Thanks~
Kevin Gates
15,053 PointsKevin Gates
15,053 PointsRob's answer is the correct one here.