sql - 查找一行中空列的总和
解决方案
您可以始终使用 GENERATED 作为列。例子:
create table test (a VARCHAR (50),
b VARCHAR (50),
c VARCHAR (50),
cnt numeric GENERATED always as (
case when a is null then 0 else 1 end +
case when b is null then 0 else 1 end +
case when c is null then 0 else 1 end
) STORED);
推荐阅读
- 3d - 如何在 3D 空间中放置一个垂直于表面的对象?
- c++ - std::chrono::duration::count 返回什么?
- android - 使用 Moshi JsonWriter 序列化未知的任何 / 对象
- javascript - 如何在Javascript(ES6)中缩短此功能
- angular - 在 Angular 中从 Azure 下载元素期间的 ZoneAwarePromise 数组
- autodesk-forge - 将属性从 Revit 转换为 IFC 时,使用 Revit 本地文件语言而不是英语
- r - 单元格中带有间隔的表格
- postgresql - 如何更改 PGDATA potsgres docker 的物理卷?
- csv - AWS CLI 输出到 CSV 以包含列标题
- laravel - 将条件放在第一个数组中有很多 laravel