Sobald eine Tabelle in der Datenbank hergestellt wird, gibt es viele bedingen, wo wir die Struktur der Tabelle �ndern m�ssen.
Add a column
Drop a column
Change a column name
Change the data type for a column
changing the primary key specification
Syntax
ALTER TABLE "table_name" [alter specification]
Let's use above syntax with "customer" table
Column Name
Data Type
First_Name
char(50)
Last_Name
char(50)
Address
char(50)
City
char(50)
Country
char(25)
Birth_Date
date
If we want to add a column called "Gender" to this table. Syntax given below:
ALTER table customer add Gender char(1)
If we want to rename "Address" to "Addr".Syntax given below:
ALTER table customer change Address Addr char(50)
If we want to change the data type for "Addr" to char(30).Syntax given below:
ALTER table customer modify Addr char(30)
If we want to drop the column "Gender".Syntax given below:
ALTER table customer drop Gender
Keywords alter table modify column, alter table sql, alter table rename,
alter table drop column, alter table mysql, alter table in oracle,
alter table syntax