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

Databases Reporting with SQL Ordering, Limiting and Paging Results Practice Session

Is there an efficient way to pull data from multiple tables that are in the same database, in the same query?

For instance, how would you run a query that would return all the columns from the reviews table in the movies database, and also include the "title" from the movies table that corresponds to each "movie_id" (preferably in between the "movie_id" and "username" columns)? Something like that might make it easier for someone reading the report to know which reviews go with which movies.

1 Answer

Steven Parker
Steven Parker
230,235 Points

What you are describing is called a JOIN, and is a commonly-used database feature. If you're impatient, you could look it up — but it's very likely covered later on in the course you are taking.

Just in case it is not, it's certainly covered in some of the other courses in the database series.