本文共 1394 字,大约阅读时间需要 4 分钟。
本文翻译自:
Given the table created using: 给定使用以下表创建的表:
CREATE TABLE tbl_Country( CountryId INT NOT NULL AUTO_INCREMENT, IsDeleted bit, PRIMARY KEY (CountryId) )
How can I delete the column IsDeleted
? 如何删除列IsDeleted
?
参考:
ALTER TABLE tbl_Country DROP COLUMN IsDeleted;
a working example. 一个有效的例子。
Note that the COLUMN
keyword is optional, as MySQL will accept just DROP IsDeleted
. 请注意, COLUMN
关键字是可选的,因为MySQL只接受DROP IsDeleted
。 Also, to drop multiple columns, you have to separate them by commas and include the DROP
for each one. 另外,要删除多个列,必须用逗号分隔它们,并为每个列包含DROP
。
ALTER TABLE tbl_Country DROP COLUMN IsDeleted, DROP COLUMN CountryName;
This allows you to DROP
, ADD
and ALTER
multiple columns on the same table in the one statement. 这允许您在一个语句中的同一个表上DROP
, ADD
和ALTER
多个列。 From the : 从 :
You can issue multiple
ADD
,ALTER
,DROP
, andCHANGE
clauses in a singleALTER TABLE
statement, separated by commas. 您可以在单个ALTER TABLE
语句中发出多个ADD
,ALTER
,DROP
和CHANGE
子句,以逗号分隔。 This is a MySQL extension to standard SQL, which permits only one of each clause perALTER TABLE
statement. 这是标准SQL的MySQL扩展,它只允许每个ALTER TABLE
语句中的一个子句。
要删除列,请使用此项,
ALTER TABLE `tbl_Country` DROP `your_col`
ALTER TABLE tbl_Country DROP columnName;
使用ALTER
:
ALTER TABLE `tbl_Country` DROP COLUMN `column_name`;
ALTER TABLE `tablename` DROP `columnname`;
要么,
ALTER TABLE `tablename` DROP COLUMN `columnname`;
转载地址:http://wbexb.baihongyu.com/