Another way to rename a column

Another way to rename a column is to use the RENAME statement together with the
CREATE TABLE statement with AS subquery. This method is useful if you are
changing the structure of a table rather than only renaming a column. The
following statements re-create the sample table hr.job_history, renaming a column from
department_id to dept_id:
CREATE TABLE temporary
(employee_id, start_date, end_date, job_id, dept_id)
AS SELECT
employee_id, start_date, end_date, job_id, department_id
FROM job_history;
DROP TABLE job_history;
RENAME temporary TO job_history;
Any integrity constraints defined on table job_history will be lost in the
preceding example. You will have to redefine them on the new job_history table using an
ALTER TABLE statement.[@more@]
请使用浏览器的分享功能分享到微信等