Rename Column Name IN SQL - sql - sql tutorial - learn sql




 process of rename column
  1. ALTER TABLE "table _name" Change "column 1" "column 2" ["Data Type"];
    
  2. ALTER TABLE "table _name" RENAME COLUMN "column 1" TO "column 2";
    
  3. ALTER TABLE Customer CHANGE Address Addr char(50);
    
  4. ALTER TABLE Customer RENAME COLUMN Address TO Addr ;
    
  • Sometimes we want to change the name of a column.
  • To do this in SQL, we specify that we want to change the structure of the table using the ALTER TABLE command, followed by a command that tells the relational database that we want to rename the column.
  • The exact syntax for each database is as follows:
  • In MySQL, the SQL syntax for ALTER TABLE Rename Column is,
ALTER TABLE "table_name"
Change "column 1" "column 2" ["Data Type"];
  • In Oracle, the syntax is,
ALTER TABLE "table_name"
RENAME COLUMN "column 1" TO "column 2";
  • Let's look at the example. Assuming our starting point is the wikitechy Customer table created in the CREATE TABLE section:

Table wikitechy Customer

  • To rename "Address" to "Addr", we key in,
Tags : sql tutorial , pl sql tutorial , mysql tutorial , oracle tutorial , learn sql , sql server tutorial

MySQL:

ALTER TABLE wikitechy Customer CHANGE Address Addr char(50);

Oracle:

ALTER TABLE wikitechy Customer RENAME COLUMN Address TO Addr;
sql tutorial , pl sql tutorial , mysql tutorial , oracle tutorial , learn sql , sql server tutorial

SQL Server:

  • It is not possible to rename a column using the ALTER TABLE statement in SQL Server. Use sp _rename instead.

This tutorial provides more the basic needs and informations on sql tutorial , pl sql tutorial , mysql tutorial , sql server , sqlcode , sql queries , sql , sql formatter , sql join , w3schools sql , oracle tutorial , mysql , pl sql , learn sql , sql tutorial for beginners , sql server tutorial , sql query tutorial , oracle sql tutorial , t sql tutorial , ms sql tutorial , database tutorial , sql tutorial point , oracle pl sql tutorial , oracle database tutorial , oracle tutorial for beginners , ms sql server tutorial , sql tutorial pdf

Related Searches to Rename Column Name IN SQL

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×