Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change table name to upper case

Tags:

I need to change table name from lowercase to uppercase but using this statement the table name can be changed but the names are in lowercase..

sql> rename table name to Name; 

is there any way to convert table name to uppercase?

like image 204
user2012 Avatar asked Jun 07 '12 08:06

user2012


People also ask

Should table names be capitalized?

Capitalization. Use sentence-style capitalization for the table title and each column heading. Use sentence-style capitalization for the text in cells unless there's a reason not to (for example, keywords that must be lowercase).

Should mysql table names be capitalized?

For table names, you may use PascalCasing ( camelCasing with the first letter also capitalized) or lowercasing conventions, as long as you are consistent. In either case, table names should only contain alphabetic characters (no "_" or "-").


2 Answers

  1. Add this line in the mysql server variables array in my.cnf:

    lower_case_table_names=2 
  2. Restart your mysql server.

  3. Now you can create or alter tables in upper case, the server will accept your query.

Note that usually, on Linux systems, the main mysql configuration file can be found in /etc/my.cnf or /etc/mysql/my.cnf.

like image 105
aleroot Avatar answered Sep 20 '22 13:09

aleroot


This should give u what you are looking for...

ALTER TABLE oldtable RENAME TO NewTable; 
like image 42
peixe Avatar answered Sep 17 '22 13:09

peixe