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

select * from table_name except col4, col5, col6 ; How to apply except in sql query?

Why there was no example video regarding except?

5 Answers

Steven Parker
Steven Parker
231,236 Points

I'm not sure what course you're working with (you did not provide a link), but "except" is one of the set operators (like "union") and while they all do something different the basic syntax is the same.

that is coming from this url > https://teamtreehouse.com/library/retrieving-specific-columns-of-information

Test/Challenge: https://teamtreehouse.com/library/sql-basics/getting-data-from-a-database/retrieving-specific-columns-of-information-2

  • check the third question.

in my opinion, the question should not be there or at least some examples were provided first.

From the Code Challenge, I dont see how the except keyword fit in. Except keyword is used to combine two SELECT statements and returns rows from the first SELECT statement that are not returned by the second SELECT statement.

The challenges only needs you to select Two Columns using the syntax:

SELECT <column 1>, <column 2> FROM ... table;

Dont forget to seperate the columns with a coma.

In my opinion, I suggest you re-watch the video https://teamtreehouse.com/library/retrieving-specific-columns-of-information

Steven Parker
Steven Parker
231,236 Points

This challenge is not asking you to use the "except" operator. The word "except" in the challenge is only identifying the columns that you won't be needing to complete the query. Just think of "except" as meaning "everything but".

I guess I may have misunderstood the question then. Thanks for all your inputs and this is now settled.