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ƒ‹”äŠrAcaseAnullif

¡‘½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Å‰‚Ì 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 ServletAJSP •ÒŽ‘—¿
¡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-2017 Y.SAK