mysql查询“类似"colmunname"的表的"SHOW COLUMNS FROM"":问题 [英] mysql query "SHOW COLUMNS FROM table like 'colmunname'":questions
问题描述
我对SHOW COLUMNS FROM table like 'column name'"
有疑问.
我已经尝试过一些测试了一段时间了,似乎就像"where column name='column'
.
I have a question about SHOW COLUMNS FROM table like 'column name'"
.
I have already tried some tests for some times, it seems be similar like "where column name='column'
.
不过,我只想确认一下 提前非常感谢你.
However, I just would like to confirm thank u very much in advance.
我还要说,为什么我不能使用SHOW COLUMNS FROM table = 'columnname'
?
Also, I'd like to say, why cannot I use SHOW COLUMNS FROM table = 'columnname'
?
推荐答案
它更像
WHERE column_name LIKE 'column name'
由于它使用LIKE
,因此您可以在参数中放入通配符模式,例如
Since it uses LIKE
, you can put wildcard patterns in the parameter, e.g.
SHOW COLUMNS FROM table LIKE '%id'
将找到所有以id
结尾的列.
will find all columns that end in id
.
如果没有通配符,则LIKE
等效于=
.
If there are no wildcard characters, then LIKE
is equivalent to =
.
如果您不想使用LIKE
,则可以使用WHERE
:
If you don't want to use LIKE
, you can use WHERE
:
SHOW COLUMNS FROM table WHERE field = 'column name';
在SHOW COLUMNS
输出中,field
列包含列名称. WHERE
子句还允许测试其他属性,例如
In the SHOW COLUMNS
output, the field
column contains the column names. The WHERE
clause also permits testing other attributes, e.g.
SHOW COLUMNS FROM table WHERE type LIKE 'varchar%'
将找到所有VARCHAR
列.
这篇关于mysql查询“类似"colmunname"的表的"SHOW COLUMNS FROM"":问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!