You can rename a column using a CHANGE old_col_name create_definition clause. To do so, specify the old and new column names and the type that the column currently has. For example, to rename an INTEGER column from a to b, you can do this: mysql> ALTER TABLE t1 CHANGE a b INTEGER; If you want to change a column's type but not the name, CHANGE syntax still requires two column names even if they are the same. For example: 430 MySQL Technical Reference for Version 4.0.1-alpha mysql> ALTER TABLE t1 CHANGE b b BIGINT NOT NULL; However, as of MySQL Version 3.22.16a, you can also use MODIFY to change a column's type without renaming it: mysql> ALTER TABLE t1 MODIFY b BIGINT NOT NULL;
thank you! have a question again! 在 mysql ms-dos 方式下如何创建一个表格?
我在MS_DOS方式下这样写:mysql>create table sales (order int not null);不能通过,不知有什么问题?
order是关键字不能用来作字段名。
那 mysql>create table sales (pro_order int not null);也不行啊!
那 mysql>create table sales (pro_order int not null);也不行啊!
是不是没有选择在数据库. mysql>use test; mysql>create table sales (pro_order int not null);
To do so, specify the old and new column names and the type that the column currently
has. For example, to rename an INTEGER column from a to b, you can do this:
mysql> ALTER TABLE t1 CHANGE a b INTEGER;
If you want to change a column's type but not the name, CHANGE syntax still requires
two column names even if they are the same. For example:
430 MySQL Technical Reference for Version 4.0.1-alpha
mysql> ALTER TABLE t1 CHANGE b b BIGINT NOT NULL;
However, as of MySQL Version 3.22.16a, you can also use MODIFY to change a column's
type without renaming it:
mysql> ALTER TABLE t1 MODIFY b BIGINT NOT NULL;
在 mysql ms-dos 方式下如何创建一个表格?
mysql>create table sales (pro_order int not null);也不行啊!
mysql>create table sales (pro_order int not null);也不行啊!
mysql>use test;
mysql>create table sales (pro_order int not null);