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

Development Tools

Jonny Dailey
Jonny Dailey
4,068 Points

Database range

Hey all,

Im working through the Mysql DB course and wanted to get more information on a topic.

Extra credit states: "Search for movies released between the year of your birth and the year you'd be 10."

How do you set a range with a Mysql query? I can show all movies in the year I was born, but I'm unsure of how to show through a certain time.

I've even tried:

SELECT * FROM movies WHERE year >= 1986 ORDER BY year ASC;

I'm unsure of how to get the year to stop 10 years later. Any help would be much appreciated.

Thanks!

3 Answers

Jonny Dailey
Jonny Dailey
4,068 Points

Came up with a working solution. Can anyone refactor this code for better efficiency?

SELECT * FROM movies WHERE year >= 1986 AND year <= 1996 ORDER BY year ASC;

I think your code is pretty well optimized as it is mate. Well done!

hey did either of you guys do the next part?

'Page through the actors in increments of 15'

I cant figure it out at all, I tired using +15 and +=15 but that didnt work, I couldnt find anything about how to 'page' through data either