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

Mia Lee
Mia Lee
572 Points

How do I write a SQL statement for the below

We're back in the sports team database. There's a results table with the columns id, home_team, home_score, away_team, away_score and played_on . Find all the matches in the results table where "Hessle" was playing away as the away team and their score was above 18 points.

5 Answers

Ari Misha
Ari Misha
19,323 Points

Hiya Mia! The question couldnt be more clear and concise. We need to show "all" columns from the "result" table, "WHERE" "Hessle" was playing for "away_team" "AND" the "away_score" was more than "18 points". I hope this must be enough to steer you to the right path. If not , post back and ask away without hesitation. Happy Coding. (:

Rhys Kearns
Rhys Kearns
4,976 Points
SELECT * FROM TableName
WHERE Away_Team = "Hessle" AND Away_Score < 18;

Your question didn't make much sense but hopefully that works

Ari Misha
Ari Misha
19,323 Points

Hiya Rhys! You've SQL Error in there. Try "=" operator instead of "IN" clause. (:

Rhys Kearns
Rhys Kearns
4,976 Points

Haha you must of been quick! I editted it about 15 seconds after :D Thanks for noticing it though!

Ari Misha
Ari Misha
19,323 Points

Hiya Rhys Kearns! Im glad you were able to solve it on your own. (:

Mia Lee
Mia Lee
572 Points

Thank you Rhys Kearns and Ari Misha!