Welcome to the Treehouse Community
Looking to learn something new?
Statements case sensitive?
Are parts of the statement case sensitive? In the video, Andrew Chalkley shows the statement creating a table as:
CREATE TABLE actors (name VARCHAR(200))
Is the "CREATE TABLE", and the datatype "VARCHAR" required to be upper case? If its not required for the statement to work, is it good practice? Or does it not really matter as long as you try to stay consistent?
Steven Parker221,573 Points
Generally, SQL is not case-sensitive.
Some databases might vary on this, but it's true in the most popular ones (Oracle, MS SQL, MySQL).
Some developers adopt a practice of using one case to show reserved words and another for fields, but the choice of case may differ. I've seen editors that have helper settings that can be set either way.
I personally prefer to use uppercase for reserved words and lowercase elsewhere, just as shown in the example. I believe this is a more common choice, but there's no universal consensus.
Kevin Korte28,135 Points
I don't know if it changes for different versions of SQL, but I believe SQL keywords are case-insensitive, however, I think it's been considered best practices to capitalize those keywords for better human readability.
However, I think that, at lease in some versions, column and table names are case sensitive, so just something to keep in mind.