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 trialA X
12,842 PointsWhy 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
Mircea Dan Dumitru
6,737 PointsTry 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.
Aamnah Akram
17,549 PointsThe 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 :)
A X
12,842 PointsA X
12,842 PointsAh, 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).
Mircea Dan Dumitru
6,737 PointsMircea Dan Dumitru
6,737 PointsYup. Generally, keeping the code tidy is a important factor in reading and understanding easier what it does. Good luck!