Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
216,136 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.