Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I can create a table with oracle but with small characters?

How I can create a table with oracle but with small characters, when I create a table with small characters it converts auto to capital characters.

like image 749
user1384279 Avatar asked Nov 12 '12 10:11

user1384279


1 Answers

Folding (non-quoted) table names to upper case is required by the ANSI SQL standard.

You can create tables (and columns) with lowercase names using a quoted identifier (again this follows the SQL standard):

CREATE TABLE "foo" 
(
   "id"          integer,
   "SomeColumn"  varchar(100)
);

I would however strongly advise you, to not do that.

Once you have your tables created that way, you have to always use double quotes because any non-quoted name will (following the rules for SQL identifiers) again be folded to upper-case and thus won't match the name as it is stored in the system catalogs.

Therefor the following statement will not work:

SELECT id, somecolumn FROM foo;

You have to use a quoted identifier:

SELECT "id", "SomeColumn" FROM "foo";

For more details on (quoted) identifiers, please read the chapter Database Object Naming Rules in the manual.

like image 113
a_horse_with_no_name Avatar answered Sep 28 '22 04:09

a_horse_with_no_name