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

Why do we use all capital letters for the keywords in SQL and what would happen if we didn't?

Hi all, I'm just starting on the SQL series videos, and I'm just curious why SQL keywords are in all caps like SELECT and FROM?

I assume that if we used something like Select or select instead it would throw a syntax error if we tried to run it? Or does the case really not matter and it's more a formality?

Thanks!

2 Answers

Try it and see for yourself, you could get an error in the worst scenario :)

In most of SQL languages, both are correct, but it's easier to read and more organised to write the keywords in caps.

Ah, so it falls into kind of a "best practices", like indentation. Yes, I'll try to monkey around myself with trying different combinations...I was just having trouble starting up SQL Playground (which I have asked about in another post).

Yup. Generally, keeping the code tidy is a important factor in reading and understanding easier what it does. Good luck!

Aamnah Akram
Aamnah Akram
17,549 Points

The case really doesn't matter, the caps are a best practice thing. People (who read your code) will like you more if you write neat and good looking code :)