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

Are the Spaces before the SQL-query invalid?

Are the Spaces before the SQL-query invalid? If we append some spaces before the SQL query, does it makes an invalid SQL-query? for Example:

 SELECT username AS "Username", first_name AS "First Name", last_name AS "Last Name" FROM users;

Gives the Error:

Bummer!

You should try writing a SELECT query

Whereas if i remove the spaces from the staring of the query, it works fine.

SELECT username AS "Username", first_name AS "First Name", last_name AS "Last Name" FROM users;

Andrew Chalkley Help needed.

Andrew Chalkley SQL Basics> Getting Data from a Database > Categorizing Your Output as "AS"> Challenge Task 2 of 4.

1 Answer

Steven Parker
Steven Parker
231,271 Points

Sometimes the challenge is more picky than the language.

I think most SQL engines disregard leading spaces. But the challenge checking mechanism apparently does not.

Andrew Chalkley
Andrew Chalkley
Treehouse Guest Teacher

Hey Steven Parker and Krishna Pratap Chouhan

I've updated this challenge to accept white space at the beginning.

If you spot any other issues like this let me know!

Regards
Andrew

Steven Parker
Steven Parker
231,271 Points

Good deal. :+1: Does Krishna get an "Exterminator" for discovering it?