Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are SQL entries written in uppercase? [duplicate]

Tags:

syntax

sql

Possible Duplicate:
Why should I capitalize my SQL keywords?

hi,

I'm pretty new to SQL, but i've noticed that writing

SELECT * FROM column_name

is almost always used when

select * from column_name

yields exactly the same result. I can't find anything online about this. Is this just a convention? Or will not using uppercase break the script on older systems/systems that i'm not aware of?

thanks

like image 908
thepandaatemyface Avatar asked Jul 19 '10 08:07

thepandaatemyface


People also ask

Why are SQL queries written in uppercase?

For readability, all SQL commands should be written in uppercase letters. This allows the reader to identify the keywords in the SQL statement and easily determine what the query is executing.

Does SQL care about capitalization?

Keywords in SQL are case-insensitive for the most popular DBMSs. The computer doesn't care whether you write SELECT , select, or sELeCt ; so, in theory, you can write however you like.

Can you write lowercase in SQL?

Whenever you want some text data from your SQL database to be displayed in lowercase, use the LOWER() function. This function takes as an argument a string or the name of a column whose text values are to be displayed in lowercase.

Is SQL capital sensitive?

The SQL keywords (SELECT, FROM, WHERE, etc.) are case-insensitive, yet they are frequently expressed in all capitals. Table and column names are case-sensitive in some settings. MySQL provides a setting that allows you to enable or disable it.


1 Answers

SQL was developed in the 1970s when the popular programming languages (like COBOL) used ALL CAPS, and the convention must have stuck.

like image 167
dan04 Avatar answered Sep 22 '22 08:09

dan04