Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.
MySQL 5.5 on Ubuntu 12.04.1

I know that the databases, users, tables, etc. are case-sensitive (at least on Linux). But what about the commands themselves?

For example, compare:

SELECT *  FROM `PINs` WHERE `pin` > 1000

and:

select * from `PINs` where `pin` > 1000

I know both "work," but are there any down-sides to using lower-case commands?

share|improve this question
    
No, you don't "know" that databases and tables are case sensitive just because the OS is Linux, as that is configurable. Never make assumptions when dealing with MySQL. Better yet, never make assumptions about anything. –  John Gardeniers Sep 17 '12 at 20:35
    
Nothing is wrong with assuming the worst case scenario. Assuming something is case-sensitive, and then being wrong wouldn't cause problems... Vice versa would... –  Soviero Sep 17 '12 at 21:13
    
assuming something is case sensitive and being wrong most certainly can cause problems. I've seen plenty of code where devs have relied on case sensitivity, only to see the entire mess come crashing down when case sensitivity is disabled. –  John Gardeniers Sep 17 '12 at 21:45
add comment

1 Answer

up vote 4 down vote accepted

MySQL commands are not case sensitive. However, many people capitalize them anyway to make them visually distinct from other parts of the query.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.