表T中有个类型为char的字段value,请分别使用值A、B、C、D进行查询,
当值为A时显示OK,值为B时显示NO,其他的显示GOOD,
请写出对应的SQL语句。
select value,decode(value,'A','OK','B','NO','GOOD')AS 结果 from T;
select value, decode(value,'A','OK','B','NO','GOOD') as 结果 from T;
SELECT value, CASE value WHEN 'A' THEN 'OK' WHEN 'B' THEN 'NO' ELSE 'GOOD' END AS result FROM T;
or
SELECT value, DECODE(value,'A','OK', 'B','NO', 'GOOD') AS result FROM T;
select value,decode(value,'A','OK','B','NO','GOOD') as 结果 from T;
select value, case value when 'A' then 'OK'
when 'B' then 'NO'
else 'GOOD'
end
as 结果
from T;