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, 4514👍, 0💬
Popular Posts:
How can you determine the size of an allocated portion of memory? You can't, really. free() can , bu...
What does static variable mean? There are 3 main uses for static variables: If you declare within a ...
How To Use Subqueries with the IN Operator? - MySQL FAQs - SQL SELECT Statements with JOIN and Subqu...
What is a fish bone diagram ? Dr. Kaoru Ishikawa, invented the fishbone diagram. Therefore, it can b...
Can Two Forms Be Nested? - XHTML 1.0 Tutorials - Understanding Forms and Input Fields Can two forms ...