如何限制列名称 [英] how to restrict colum names
本文介绍了如何限制列名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用它来获取表的列名。但我想限制它。它向我显示所有列名称我不想显示所有列名称。如何限制它?
I am using this to get table's column name. But I want to restrict it. It showing me all column name i dont want to show all column name. How to restrict it?
SELECT column_name FROM information_schema.columns WHERE table_name = 'Hadiths_old'
推荐答案
你可能有包括你不想要的名字。
你可以通过提供你的WHERE
条款来实现这一点,例如
You may have to eclude the names you don't want.
You can do that by providing yourWHERE
clause some more conditions, like
WHERE table_name='Hadiths_old'
AND column_name<>'Idontlikethisone%'
AND column_name<>'neitherthatone%'
例如。
for example.
如果你想要限制列,假设你想要查看前3列然后
if you want to restrict columns suppose you want to see top 3 columns then
SELECT top 3 column_name FROM information_schema.columns WHERE table_name = 'Hadiths_old'
如果你想看到名字开头abc charecters的栏目
if you want to see columns which name start abc charecters
SELECT column_name FROM information_schema.columns WHERE table_name='Hadiths_old' and column_name like 'abc%';
如果你想看到名字中包含abc字的列
if you want to see columns which name contains abc word
SELECT column_name FROM information_schema.columns WHERE table_name ='Hadiths_old' and column_name like '%abc%';
这篇关于如何限制列名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文