如何显示除MySQL中的某些表以外的表中的列名?
要排除某些列名,请使用NOTIN。
让我们首先创建一个表-
mysql> create table DemoTable780 ( CustomerId int, CustomerName varchar(100), CustomerAge int, CustomerCountryName varchar(100), isMarried tinyint(1) );
这是排除结果的查询-
mysql> select group_concat(column_name) from `information_schema`.`COLUMNS` m
where
table_schema = 'web' and
table_name = 'DemoTable780' and
column_name not in ('CustomerId','CustomerCountryName')
group by table_schema,table_name;这将产生以下输出-
+------------------------------------+ | group_concat(column_name) | +------------------------------------+ | CustomerName,CustomerAge,isMarried | +------------------------------------+ 1 row in set (0.01 sec)
热门推荐
7 甄嬛传祝福语简短
10 中班入学祝福语简短大全
11 六一加端午祝福语简短
12 宝宝生病简短祝福语大全
13 虎年伊始祝福语大全简短
14 生日祝福语男孩 简短独特
15 横幅元旦祝福语大全简短
16 周末愉快祝福语高级简短
17 项目总生日祝福语简短
18 生日祝福语古朴简短独特