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 Day 1: Joining Tables 7th Grade Science

György Varga
György Varga
19,198 Points

Case sensitivity

Hi!

Here is my solution where you don't need to check the subjects table if that the name of the subjects start with uppercase or lowercase letter.

SELECT DISTINCT teachers.id, teachers.first_name, teachers.last_name FROM teachers
INNER JOIN classes ON teachers.id = classes.teacher_id
INNER JOIN subjects ON classes.subject_id = subjects.id
WHERE subjects.grade = 7 AND UPPER(subjects.name) = UPPER("sCieNce");

2 Answers

Steven Parker
Steven Parker
229,644 Points

You've definitely discovered the way to eliminate case sensitivity. :+1:

And LOWER would also do the same job. But you don't need to use the function twice when comparing literals, just be sure your literal matches the case you're converting to:

WHERE subjects.grade = 7 AND UPPER(subjects.name) = "SCIENCE";