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 SQL Reporting by Example Orientation: Selecting Data Orientation Quiz

Can anybody tell me why the answer is 6?

I just don't understand it's going to be 6

1 Answer

Steven Parker
Steven Parker
218,848 Points

I assume you're asking about this question:

The EMPLOYEES table has 23 columns and the JOBS table has 4. How many COLUMNS does the following query return?

SELECT FIRST_NAME, LAST_NAME, JOBS.*
FROM EMPLOYEES
JOIN JOBS ON EMPLOYEES.JOB_ID = JOBS.ID;

If you look at what is being SELECTed, you'll see that it is FIRST_NAME, LAST_NAME, and JOBS.* which means "everything from JOBS". So that's 2 name columns, and all 4 columns from JOBS, for a total of 6. Make sense now?

I misunderstood the concepts beforeļ¼Œthank you for your explanation.