Changing a Column Name : Alter Column : Table MySQL TUTORIALS


MySQL TUTORIALS » Table » Alter Column »

 

Changing a Column Name


mysql>
mysql> CREATE TABLE Employee(
    ->     id            int,
    ->     first_name    VARCHAR(15),
    ->     last_name     VARCHAR(15),
    ->     start_date    DATE,
    ->     end_date      DATE,
    ->     salary        FLOAT(8,2),
    ->     city          VARCHAR(10),
    ->     description   VARCHAR(15)
    -> );
Query OK, rows affected (0.03 sec)

mysql>
mysql>
mysql> ALTER TABLE employee
    -> CHANGE First_Name FirstName VARCHAR(20);
Query OK, rows affected (0.05 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql>
mysql> DESCRIBE employee;
+-------------+-------------+------+-----+---------+-------+
| Field       | Type        | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+-------+
| id          | int(11)     | YES  |     | NULL    |       |
| FirstName   | varchar(20| YES  |     | NULL    |       |
| last_name   | varchar(15| YES  |     | NULL    |       |
| start_date  | date        | YES  |     | NULL    |       |
| end_date    | date        | YES  |     | NULL    |       |
| salary      | float(8,2)  | YES  |     | NULL    |       |
| city        | varchar(10| YES  |     | NULL    |       |
| description | varchar(15| YES  |     | NULL    |       |
+-------------+-------------+------+-----+---------+-------+
rows in set (0.01 sec)

mysql>
mysql>
mysql> drop table Employee;
Query OK, rows affected (0.02 sec)

mysql>
mysql>



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Table
» Alter Column