Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Rename an Existing Column in a Table
How To Rename an Existing Column in a Table? - MySQL FAQs - Understanding SQL CREATE, ALTER and DROP Statements
✍: FYIcenter.com
If you have an existing column in a table and you want to change the column name, you can use the "ALTER TABLE ... CHANGE" statement. This statement allows you to change the name of a column, and its definition. The tutorial script below gives you a good example:
mysql> ALTER TABLE tip CHANGE COLUMN subject title VARCHAR(60); Query OK, 1 row affected (0.51 sec) Records: 1 Duplicates: 0 Warnings: 0 mysql> SHOW COLUMNS FROM tip; +-------------+--------------+------+-----+---------+------- | Field | Type | Null | Key | Default | Extra +-------------+--------------+------+-----+---------+------- | id | int(11) | NO | PRI | | | title | varchar(60) | YES | | NULL | | description | varchar(256) | NO | | | | author | varchar(40) | YES | | NULL | +-------------+--------------+------+-----+---------+------- 4 rows in set (0.02 sec)
2007-05-11, 4690👍, 0💬
Popular Posts:
How To Get the Minimum or Maximum Value of an Array? - PHP Script Tips - PHP Built-in Functions for ...
What is the significance of Finalize method in .NET? .NET Garbage collector does almost all clean up...
How To Write a Query with a Right Outer Join? - Oracle DBA FAQ - Understanding SQL SELECT Query Stat...
If we have two version of same assembly in GAC how do we make a choice ? OK first let’s try to under...
Explain all parts of a deployment diagram? Package: It logically groups element of a UML model. Node...