September 20th, 2012, 03:55 PM
SQL Data Case Sensitivity
I switch a lot between Oracle 11g Database, MS SQL Server, and PostgreSQL. I was wondering if there's a specified or preferred way to syntax data entered in. I read in my Oracle book that all SQL data should be entered in UPPERCASE format and to standardize on this. I'm not sure if this is up to the DBA to select how the data is entered in the system but I figured I would ask this basic elementary question. All my data in Oracle 11g is UPPERCASE but my data in PostgreSQL is in lowercase.
Thanks for any info.
September 20th, 2012, 04:07 PM
Really? All data is entered in upper case? Even Names, Streets, Cities?
Or are you talking about object names (tables, columns, views, ...) ?
If the latter, then simply enter it as you wish, just make sure you don't use quoted identifiers and you should be fine.
If nothing is quoted, then SELECT * FROM FOO is the same as select * from foo because SQL is case-insensitive.
However SQL Server chooses not to always respect that. Whether or not object names are case-sensitive depends on the collation of the database. So for SQL Server my above example is not always true.
I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags.
Tips on how to ask better questions:
October 2nd, 2012, 08:13 AM
I use it as a best practice that ALWAYS database "field names" are returned uppercase, no matter how they are saved in the database.
I used this first time due to Oracle project 5 years ago and found it good also for mysql and pgsql.
Now it depends on your database interface, plugin or whatever to be able to return your dataset as "uppercase".