Search code examples
databasecase-sensitivecase-insensitive

What is currently the standard for database case


So have I read tons of convention about database and programming. However, I don't remember if there is one suggesting a standard case for database.

Is it standard for a database to be case sensitive or is it standard to be case insensitive?

I know some database technology default case vary from one to another (SQL, Oracle, mysql, etc.) This isn't what I'm looking for, because the default case for some technology may be again the standard.

Thanks


Solution

  • The SQL standard requires unquoted identifiers to be case insensitive. This has been in the SQL standard since the beginning (so back in 1986 or so)

    Quoted identifiers however are case sensitive

    So according to the standard foo and FOO are identical, but "foo" and "FOO" are not.

    If you are talking about comparison of character values, then the SQL standard makes this dependent on the collation the character strings are defined in: "The comparison of two character string expressions depends on the collation used for the comparison"

    The standard lists some collation names, but does not mention whether they are supposed to be case-sensitive. In fact the documentation of the "collation descriptor" only lists:

    • The name of the collation.
    • The name of the character repertoire to which it is applicable.
    • A list of the names of the character sets to which the collation can be applied.
    • Whether the collation has the NO PAD or the PAD SPACE characteristic.