Databases SQL Basics Getting Data from a Database Categorizing Your Output with 'AS'

Erin Clayton
Erin Clayton
3,840 Points

What's wrong with this code? Looks good to me?

SELECT home_team AS "Home Team", home_score AS "Home Score", away_team AS "Away Team", played_on AS "Date Played", away_score AS "Away Score" FROM results;

2 Answers

Grace Kelly
Grace Kelly
33,988 Points

Hi Erin, you're code is technically correct, however the code challenge requires the columns be in a particular order which is: home_team, home_score, away_team, away_score, played_on

Hope that helps!!!

Erin Clayton
Erin Clayton
3,840 Points

Thanks... so you are saying in regular SQL order doesn't matter, right? But in Treehouse's SQL it is coded to where it has to go in order?

Okay. Got it.

Dave StSomeWhere
Dave StSomeWhere
19,808 Points

Nothing really wrong with your code but the challenge is looking for a specific order for the variables and is providing a confusing error message about selecting from the "results" table.

Make sure you order the SELECT variables in the exact order in the challenge and it will be accepted.