检查SQL表中的所有字段 [英] Checking all the fields in SQL table

查看:108
本文介绍了检查SQL表中的所有字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我有一个不同字段的SQL表。现在我想检查所有值是否为null,并仅选择那些非空值。我怎样才能做到这一点?有人请帮助我。



提前致谢,

Ajay

解决方案

< blockquote>两者都是不同的情况。



如果你想检查所有值是否为null



使用



 选择 * 来自 TableName 





如果你想检查所有非空的值。



使用



从TableName中选择*,其中ColumnName不为null 





但我不认为你想问这个,因为即使是sql中的初学者也知道如何使用null并且在where子句中不为null 。



所以请说明你想要达到的目的,并提供样本表,数据和你的目标。


这样,< br $>


id名称年龄

1 null null



null null 8



null sony null



输出应该是喜欢这个 -



1

8

sony



我希望现在更清楚了。


试试这个...... :)





  SELECT  columnName  FROM  TableName  WHERE  columnName  IS   NOT   NULL  


Hello,

I've one SQL table with different fields. Now i want to check all the values whether it's null or not and select only those values which are not null. How can i do that? Some one please help me.

Thanks in advance,
Ajay

解决方案

Both are different cases.

If you want to check all the values whether it's null or not

use

select * from TableName 



and if you want to check all the values which are not null.

use

select * from TableName where ColumnName is not null



But i don't think that you want to ask this, as even a beginner in sql knows the how to use is null and is not null in where clause.

so please clarify what you want to achieve and provide sample table, data and your goal.


like this,

id name age
1 null null

null null 8

null sony null

the output should be like this-

1
8
sony

I hope it's more clear now.


try this...:)


SELECT columnName FROM TableName WHERE columnName IS NOT NULL


这篇关于检查SQL表中的所有字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆