MySQL: Can't give tables a name in Upper Camel

2020-03-04 07:38发布

I read that it is best practise to have table names in Pascal Case (ThisIsMyTableName). Therefor I would like to change my tables in MySQL. But neither phpmyadmin, nore SQL Manager 2005 for MySQL will let me. The names stay to appear in lowercase, as if I didn't to a change at all.

Any suggestions to solve this problem?

4条回答
霸刀☆藐视天下
2楼-- · 2020-03-04 07:53

Use RENAME

example:

RENAME TABLE this_is_my_table_name TO ThisIsMyTableName;

details : http://dev.mysql.com/doc/refman/5.1/en/rename-table.html

查看更多
该账号已被封号
3楼-- · 2020-03-04 08:04

In MySQL, you can quote the table names everywhere to make them case preserving and sensitive.

`MyTableName`
查看更多
看我几分像从前
4楼-- · 2020-03-04 08:06

The easiest way to take care of this is to add the following to your .ini file

lower_case_table_names=2

2 is the significance here for Windows. You can read more about it here Identifier Case Sensitivity

查看更多
放荡不羁爱自由
5楼-- · 2020-03-04 08:08

I advice against mixed case because of problems with case sensitivity. A fully tested solution on one platform where case doesn't matter may actually fail when deployed on a platform where case DOES matter. For that reason alone I suggest sticking with either all caps or all lower case. I use lower case because it is easier on the eye and make spelling errors easier to spot in fixed width fonts used in most editors.

查看更多
登录 后发表回答