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 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,350 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;