-
交互式爱情
实际上有一种方法,你当然需要有权限来做这件事.SET @sql = CONCAT('SELECT ', (SELECT REPLACE(GROUP_CONCAT(COLUMN_NAME), '<columns_to_omit>,', '')
FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '<table>' AND TABLE_SCHEMA = '<database>'), '
FROM <table>');PREPARE stmt1 FROM @sql;EXECUTE stmt1;顶替<table>, <database> and <columns_to_omit>
-
泛舟湖上清波郎朗
在MySQL定义(手册)中没有这样的东西。但是如果你有很多列col1, ..., col100,以下内容可能是有用的:mysql> CREATE TEMPORARY TABLE temp_tb SELECT * FROM orig_tb;mysql> ALTER TABLE temp_tb DROP col_x;mysql> SELECT * FROM temp_tb;
-
UYOU
在这种情况下,视图会更好吗?CREATE VIEW vwTableas SELECT
col1
, col2
, col3
, col..
, col53
FROM table