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, 4633👍, 0💬
Popular Posts:
What's wrong with this initialization? char *p = malloc(10); My compiler is complaining about an ``i...
What is Concern in AOP? gA concern is a particular goal, concept, or area of interesth There are m...
Which bit wise operator is suitable for turning off a particular bit in a number? The bitwise AND op...
If we have two version of same assembly in GAC how do we make a choice ? OK first let’s try to under...
What is the difference between include directive & jsp:include action? Difference between includ...