简体   繁体   中英

How to add null values in columns in Hive

I had a table and need to add one condition in column.

Select Age_Flag from table where (Age_Flag <> "AB" or isnotnull(Age_Flag)=False) and Date="2022-17-01";

My condition was to exclude only Age_Flag=AB and include all null value.The above query excluding null value and Age_Flag=AB.

You can check for NULL values with IS in hive also

So your query will be

Select Age_Flag from table 
where (Age_Flag <> "AB" or Age_Flag IS NULL) and Date="2022-17-01";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM