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 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
231,184 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.