Is it possible to create a table with column name containing space? If so how can I create and use it?
To select a column name with spaces, use the back tick symbol with column name. The symbol is ( ` `). Back tick is displayed in the keyboard below the tilde operator ( ~).
It is possible, but it is not advisable. You need to enclose the column name in double quotes.
Column names can contain any valid characters (for example, spaces).
In PowerCenter a SQL query containing column names with spaces or special characters is invalid, even if the SQL is valid in the database. For example, if a Microsoft SQL query has column names with spaces, the query is valid in the Query Analyzer but invalid in the Designer.
It is possible, but it is not advisable. You need to enclose the column name in double quotes.
create table my_table ("MY COLUMN" number);
But note the warning in the documentation:
Note: Oracle does not recommend using quoted identifiers for database object names. These quoted identifiers are accepted by SQL*Plus, but they may not be valid when using other tools that manage database objects.
The name will be case-sensitive, and you wil have to enclose the name in double quotes every time you reference it:
select "MY COLUMN" from my_table;
So... don't, would be my advice...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With