Collections:
Rename a Column in an Existing Table in Oracle
How To Rename a Column in an Existing Table in Oracle?
✍: FYIcenter.com
Let's say you have an existing with an existing column, but you don't like the name of that column, can you rename that column name? The answer is yes. You can use the ALTER TABLE ... RENAME COLUMN statement to do this. See the following SQL script:
SQL> CREATE TABLE emp_dept_90 2 AS SELECT * FROM employees WHERE department_id=90; Table created. SQL> SELECT first_name, last_name FROM emp_dept_90; FIRST_NAME LAST_NAME -------------------- ------------------------- Steven King Neena Kochhar Lex De Haan SQL> ALTER TABLE emp_dept_90 RENAME COLUMN first_name 2 TO fname; Table altered. SQL> SELECT fname, last_name FROM emp_dept_90; FNAME LAST_NAME -------------------- ------------------------- Steven King Neena Kochhar Lex De Haan
As you can see the column "first_name" is nicely changed to "fname".
⇒ Delete a Column in an Existing Table in Oracle
⇐ Add a New Column to an Existing Table with a Default Value in Oracle
2019-05-25, 2568🔥, 0💬
Popular Posts:
How To List All Stored Procedures in the Current Database in SQL Server Transact-SQL? If you want to...
How To Insert New Line Characters into Strings in SQL Server Transact-SQL? If you want to break a st...
What Are the Underflow and Overflow Behaviors on FLOAT Literals in SQL Server Transact-SQL? If you e...
How To Connect the Oracle Server as SYSDBA in Oracle? This is Step 4. The best way to connect to the...
What Is Program Global Area (PGA) in Oracle? A Program Global Area (PGA) is a memory buffer that is ...