In MSSQL I can select a column and change the column header by doing:
SELECT mycolumn as 'MyNewColumnName' from MyTable
This doesn't work in Oracle. How do I perform the same thing in Oracle?
To change a column name, enter the following statement in your MySQL shell: ALTER TABLE table_name RENAME COLUMN old_column_name TO new_column_name; Replace table_name , old_column_name , and new_column_name with your table and column names.
To change a column heading to two or more words, enclose the new heading in single or double quotation marks when you enter the COLUMN command. To display a column heading on more than one line, use a vertical bar (|) where you want to begin a new line.
ALTER TABLE table_name RENAME TO new_table_name; Columns can be also be given new name with the use of ALTER TABLE. QUERY: Change the name of column NAME to FIRST_NAME in table Student.
Unfortunately, as rp0428 already mentioned, there is no way to rename more than one column in a single ALTER statement.
Remove single quotation marks
SELECT mycolumn as MyNewColumnName from MyTable
Enclose alias in double quotation marks
SELECT mycolumn as "MyNewColumnName" from MyTable
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