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, 4643👍, 0💬
Popular Posts:
How to create a thread in a program? You have two ways to do so. First, making your class "extends" ...
What Tools to Use to View HTML Documents? The basic tool you need to view HTML documents is any Web ...
What is triple constraint triangle in project management ? Project Management triangle is depicted a...
What is the difference between const char* p and char const* p? In const char* p, the character poin...
Does there exist any other function which can be used to convert an integer or a float to a string? ...