必须会的SQL语句(五) NULL数据处理和类型转换

2023年 4月 19日 41.6k 0

1.Null数据的处理 1)检索出null值 select * from 表 where xx is null 2)null值替换 select name, isnull ( cast (字段 as varchar(20)) , '空') from 表名 2.数据类型转换 1)Cast --'101'可以用表中字段来替换 se

1.Null数据的处理

    1)检索出null值
              select * from 表 where xx is null
  
    2)null值替换
     select
         name,
         isnull ( cast (字段 as varchar(20)) , '空')
     from 表名
 2.数据类型转换    1)Cast
        --'101'可以用表中字段来替换
        select cast('101' as varchar(20))
  
    2)Convert
        select convert(varchar(20),100)

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论