When writing SQL queries, do the commands, like SELECT and FROM have to be all capital letters?
Answer
No, SQLite, which Codecademy uses, is case-insensitive when it comes to clauses like SELECT and FROM which can be cased in any way. This is different from other programming languages such as Python where casing is quite important.
Example
/* Both of the following queries will return the same result. */
SELECT * FROM table;
select * from table;
Is capitalizing the common practice though?
Why do codecademy exercises have the commands capitalized?
Also, how about data types such as INTEGER, REAL, DATE, etc
For those who liked my question (I assume u guys are interested in the answer)
after looking here and there, including stack-overflow: it does not matter
capitalization is suggested for better reading but not necessary especially with the IDEs that people work with today, in which the keywords are automatically highlighted in different color
Pretty much, it depends on who you are working with and what standards you guys plan to set;
on your own, feel free to do whatsoever (capitalize it or not) ;o
I heard that Oracle DB automatically uppercases all commands, whereas PostgreSQL lowercases all of them. However, I never understood the point of that - if both are actually case-insensitive…?
Running SQLite3 through the Linux CLI Shell, I can get every clause to work fine no matter whether I capitalize or not. However, to query the DB and successfully print the results to the screen, I must capitalize SELECT * FROM db;
Interesting, I wonder why.
This is up to personal preference whether you choose to use purely capitalization or no, but back in the days, when we didn’t have these fancy IDEs with the keywords having colors to give more readability, the only way to add readability back then was just using capitalization