Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I store all the text in my database in uppercase or in lowercase?

Tags:

database

Which one do you prefer to store text in your database? The original casing of the data, or some kind of normalization. Also, should I enforce this with triggers? or should I preprocess input data with client code?

I ask you, because I'm not sure about if there is any difference, besides additional processing time to display data (capitalization of names, for example).

like image 973
Alex. S. Avatar asked Nov 14 '08 19:11

Alex. S.


People also ask

Does upper or lowercase matter in SQL?

All Caps SQL Commands Show example queries with ALL CAPS, First Letter Caps, and lowercase SQL commands. 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.

Should databases be capitalized?

It is legal to write commands in lowercase, but this often leads to subtle bugs with lowercase attribute/column names, so we expect you to use the ALLCAPS convention for any commands or datatypes. Database names (e.g. c9 or imdb ) should be lowercased (no numbers or special characters lie "_" or "-").

Should I use uppercase in SQL?

No, the SQL language is not case-sensitive. Any SQL command text can mixed uppercase and lowercase letters.

Which is better lowercase or uppercase?

It is thought by cognitive scientists and typographers alike, that lower-case text is more legible than upper-case. Yet lower-case letters are, on average, smaller in height and width than upper-case characters, which suggests an upper-case advantage.


1 Answers

Store in original case, unless there is a reason to do otherwise. The time spent to upper or lower case the data is likely very small, and you never know when you'll want the real, original data back in the future.

like image 114
tloach Avatar answered Sep 29 '22 23:09

tloach