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 Listing Subjects

Darshen Patel
seal-mask
.a{fill-rule:evenodd;}techdegree
Darshen Patel
Front End Web Development Techdegree Student 18,928 Points

Detailed Subjects Query

Since the question asks for "Which subjects are taught at Jefferson Middle School?"

Would we not look soley for the NAME? Thus creating a query as below:

SELECT NAME FROM SUBJECTS GROUP BY NAME ORDER BY NAME;

The video answer seemed to call everything form the Table rather than the subjects themselves.

3 Answers

Personally, I consider "7th Grade Math" to be separate from "8th Grade Math" and so on, so I actually went for something similar to the video, but included the grade as well. It can really be interpreted different ways (like many real world problems or practices that emulate them)

Dale Severude
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Dale Severude
Full Stack JavaScript Techdegree Graduate 71,324 Points

Hi Darshen,

You are correct that the video should only select the name, instead of everything in the table, but that is what he did.

I did it a different way, but agree with you in the result.

select distinct(name) from subjects;

I took it even a step farther with the following:

SELECT DISTINCT name AS "Subjects Taught" FROM subjects;