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 Querying Relational Databases Subqueries Review and Practice

How to use Subqueries ?

According to the video ,When use Subqueries, it only use to return only one column inside inner query. That mean I cannot use Subqueries to return maluti columns ?

What do you mean by "need a temporary dataset to join with other tables in your database." ?

1 Answer

Steven Parker
Steven Parker
231,269 Points

At 00:49, when the video says "the subquery can only return one column", they don't mean that a subquery is limited to just one column, but that you can choose to have it do so when it fits your needs. A better comment might have been to say "the subquery can be made to only return one column". A subquery can return any number of columns, but often the situation requires just one.

I couldn't find your other quote in the video, but perhaps you meant at 00:29 where we hear "Or when you need to create a temporary data view, that you can join to other data elsewhere in your database." If so, by my understanding that just means the situation makes using a subset or aliased view of a table preferable to using the entire original table for joining.