Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I write table and column names ALWAYS lower case?

I wonder if it's a problem, if a table or column name contains upper case letters. Something lets me believe databases have less trouble when everything is kept lower case. Is that true? Which databases don't like any upper case symbol in table and column names?

I need to know, because my framework auto-generates the relational model from an ER-model.

(this question is not about whether it's good or bad style, but only about if it's a technical problem for any database)

like image 206
openfrog Avatar asked Jan 08 '10 17:01

openfrog


People also ask

Should database columns be lowercase?

1. Only Use Lowercase Letters, Numbers, and Underscores. Don't use dots, spaces, or dashes in database, schema, table, or column names. Dots are for identifying objects, usually in the database.

Should table name be capitalized?

Table names are stored in lowercase on disk and name comparisons are not case-sensitive. MySQL converts all table names to lowercase on storage and lookup. This behavior also applies to database names and table aliases.

What are the rules to name the tables and columns?

Each table name and column name should start with a capital letter. The table name should be end with letter "s" (or "es") to indicate plural. If the index name contains more than one word then the first character of each word should be a capital and separated with an underscore (_).

Should database name be capitalized?

Database names (e.g. c9 or imdb ) should be lowercased (no numbers or special characters lie "_" or "-").


1 Answers

As far as I know there is no problem using either uppercase and lowercase. One reason for the using lower case convention is so that queries are more readable with lowercase table and column names and upper case sql keywords:

SELECT column_a, column_b FROM table_name WHERE column_a = 'test' 
like image 79
rosscj2533 Avatar answered Sep 22 '22 14:09

rosscj2533