SAK }‘ŠÙ

SAK Streets ƒƒCƒ“ƒXƒgƒŠ[ƒg }‘ŠÙEƒJƒtƒF ˆê—— SAK Streets ŒŸõ
| VB | SQL | Perl | PHP | ASP | JSP | C | PC | HP | FAQ | ƒtƒŠ[ƒ\ƒtƒg |

MySQL •Ò15 - “ÁŽêŠÖ”A‘½d”»’èAƒkƒ‹”»’èAƒkƒ‹”äŠrAcaseAnullif

¡‘½d”»’è

  EOracle ‚Æ“¯‚¶‚悤‚É case ‚ªŽg‚¦‚é‚Ì‚Å”ñí‚É‹­—Í‚Å‚ ‚éB

select key1,
  case
    when key1 = 'a001' then 'aaa'
    when key1 = 'b002' then 'bbb'
    when key1 = 'c003' then 'ccc'
    else 'xxx'
  end c1
  from testm
;

+------+------+
| key1 | c1   |
+------+------+
| a001 | aaa  |
| a011 | xxx  |
| b002 | bbb  |
| c003 | ccc  |
+------+------+

select key1,
  case key1
    when 'a001' then 'aaa'
    when 'b002' then 'bbb'
    when 'c003' then 'ccc'
    else 'xxx'
  end c1
  from testm
;

¡ƒkƒ‹”»’è

  Ecoalesce() ŠÖ”‚ÍAʼn‚Ì null ‚Å‚È‚¢ƒf[ƒ^‚ð•Ô‚·B

select coalesce(null, 'abc', 'def');

+------------------------------+
| coalesce(null, 'abc', 'def') |
+------------------------------+
| abc                          |
+------------------------------+

¡ƒkƒ‹”äŠr

  Enullif() ŠÖ”‚ÍA“™‚µ‚¯‚ê‚Î null ‚ªA“™‚µ‚­‚È‚¯‚ê‚΃f[ƒ^1 ‚ª•Ô‚éB
    ŽŸ‚Ì—á‚ÍAnull ‚ª•Ô‚éB

select nullif('abc', 'abc');

+----------------------+
| nullif('abc', 'abc') |
+----------------------+
| NULL                 |
+----------------------+

  EŽŸ‚Ì—á‚ÍA'abc' ‚ª•Ô‚éB

select nullif('abc', 'def') ;

+----------------------+
| nullif('abc', 'def') |
+----------------------+
| abc                  |
+----------------------+

¡MySQL •ÒŽ‘—¿
¡PostgreSQL •ÒAJAVA ServletAJSP •ÒŽ‘—¿
¡SQL Šî‘b•ÒŽ‘—¿
¡SQL Šî‘bŽÀ’n•ÒŽ‘—¿
¡SQL ƒ`ƒ…[ƒjƒ“ƒO•ÒŽ‘—¿
¡Oracle PL/SQL •ÒŽ‘—¿
| VB | SQL | Perl | PHP | ASP | JSP | C | PC | HP | FAQ | ƒtƒŠ[ƒ\ƒtƒg |

SAK Streets ƒƒCƒ“ƒXƒgƒŠ[ƒg }‘ŠÙEƒJƒtƒF ˆê—— SAK Streets ŒŸõ



Copyright (C) 1999-2024 Y.SAK