简体   繁体   English

Postgres:如何查找特定列具有“空”值的行?

[英]Postgres: How to find rows in which a specific column has 'empty' values?

I need to find rows which have a empty values in a column after a CSV import.我需要在 CSV 导入后的列中查找具有空值的行。 The column is an INTEGER column, hence the该列是INTEGER列,因此

...
where col = ''

doesn't work for me.对我不起作用。

You can check for empty values using您可以使用检查

where col is null

If you want to select null as 0 (or any other default value) use coalesce如果要将 select null 设为 0(或任何其他默认值),请使用 coalesce

select coalesce(max(col), 0)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SQL如何查找具有特定列的最高值的行 - SQL how to find rows which have highest value of specific column 如何为具有关键数据的另一列找到不同的值? - How to find distinct values for another column which has critical data? 当一列有多个值时,如何查找缺少的特定值? - how to find a specific value missing when a column has multiple values? Postgres如何查找jsonb类型列中包含键和数组的行,其中包含一些带有或条件的值 - Postgres how to find rows where in jsonb type column contains key with array which contain some value with or condition 如何计算具有 NULL 值的特定列的不同行是所有行 - How to take count of distinct rows which have a specific column with NULL values is all rows 如何找到哪一列为空? - How can I find which column is empty? 将表中具有多个值的列中的字符串拆分为单独的行 - Splitting string in column in table which has multiple values into separate rows 如何对相邻列中具有不同值的 SQL 中的多行求和 - How to sum multiple rows in SQL which has different values in the adjacent column 如何将多个值添加到 SQL 中已填充其他行的列 - How do I add multiple values to a column in SQL which already has other rows filled 如何找到netezza中不同行中具有相同值的列的最大值 - how to finding max of a column which has same values in different rows in netezza
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM