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 trialJackson Cromer
7,548 PointsSQL Playground Issue
I'm having an issue where the columns do not match up with data in their respective column. All of the data appears, but the columns are off by two places.
4 Answers
Steven Parker
231,269 PointsIt seems to omit column names in the header if it was used before (even in a different table).
I used aliases to make all the column names unique, and the output looks as expected:
SELECT t.ID, t.FIRST_NAME, t.LAST_NAME,
c.ID AS Class, c.SUBJECT_ID, c.PERIOD_ID, c.TEACHER_ID, c.ROOM_ID,
s.ID AS Subject, s.NAME, s.GRADE, s.DESCRIPTION
FROM TEACHERS t
JOIN CLASSES c ON t.ID = c.TEACHER_ID
JOIN SUBJECTS s ON s.ID = c.SUBJECT_ID
WHERE GRADE = 8;
Jackson Cromer
7,548 PointsNice solution! Thank you for your help, Steven!
Steven Parker
231,269 PointsGlad to help. It's still a bug that it doesn't work your way, I hope that gets fixed.
Happy coding!
Jason Anders
Treehouse Moderator 145,860 PointsHey Jackson,
I noticed that weird glitch too. It seems to be because the CLASS_ID
(the PK from CLASSES shows up in his playground, but not the one we use. That seems to be why everything is shifted by one.
Tagging Ben Deitch for a fix. :)
Run the second and third query (with the two JOINS) and you'll see what we mean. :)
Edit: This also happens in the next video's playground as well.
Jackson Cromer
7,548 PointsWonderful! Thank you for your help, Jason!
Ben Deitch
Treehouse TeacherHey all!
This seems to be a bug with SQL Playgrounds. Between those three tables selecting * should give you 12 columns. However, 3 of those columns are 'ID', and it looks like it's only willing to display 1 'ID' column :/. I'll follow up with the folks who maintain SQL Playgrounds and see if we can't figure out a solution.
Thanks for pointing this out!
Mary Urban
6,321 PointsI had that issue in the last lesson, then I realized if I always click on the current playground associated with the section I am working on, it works just fine. When I tried this lesson, it worked for me. Hopefully this helps - unless it had already been fixed by now and that's why this is working for this lesson.
Jackson Cromer
7,548 PointsJackson Cromer
7,548 PointsI have a screenshot of the query and what it pulled from the database, but I can't post the photo. Any ideas?