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 |

SQL Šî‘b•Ò (‚»‚ÌŒÜ) ƒL[ƒ[ƒh charAvarchar2AnumberAlongAraw

¡ƒRƒƒ“ƒg

  --          ’PˆêƒRƒƒ“ƒg
  /*          •¡”sƒRƒƒ“ƒgŠJŽn
  */          •¡”sƒRƒƒ“ƒgI—¹

¡€–Úƒ^ƒCƒv

  char()      Å‘å  255 ŒÅ’è’·•¶Žš
  varchar2()  Å‘å 2000 ‰Â•Ï’·•¶Žš
  number()    ¸“x‚Ə¬”•”Žw’è
  long        Å‘å 2GB ‚܂ł̉•ϒ·•¶Žš
  date        “ú•tŽžŠÔ(•b’PˆÊ‚܂ňµ‚¦‚é)
  raw(255)    Å‘å 255 bytes ‚Ü‚Å‚Ì 2 iƒf[ƒ^
  long raw    Å‘å 2GB ‚Ü‚Å‚Ì 2 iƒf[ƒ^

¡ŽZp‰‰ŽZŽq

  +           ‰ÁŽZ
  -           Œ¸ŽZ
  *           æŽZ
  /           œŽZ
  ||          •¶Žš—ñ‚ÌŒ‹‡

¡”äŠr‰‰ŽZŽq

  <           ‚æ‚菬‚³‚¢
  <=          ˆÈ‰º
  >           ‚æ‚è‘å‚«‚¢
  >=          ˆÈã
  =           “™‚µ‚¢
  <>          “™‚µ‚­‚È‚¢
  not         ”ے艉ŽZŽq
  is null     NULL ‰‰ŽZŽq
  between     ’l‚Ì”ÍˆÍ (Žó’” between 100 and 200)
  like        •¶Žš”äŠrA•”•ªˆê’v (Žó’”ԍ† like '01___1-001'AŽó’”ԍ† like '000001-%')

¡˜_—‰‰ŽZŽq

  and
  or
  not

¡W‡‰‰ŽZŽq

  union       –â‚¢‡‚킹Œ‹‡ (d•¡s‚ÍŠÜ‚ß‚È‚¢)
  union all   –â‚¢‡‚킹Œ‹‡ (‘S‚ÄŒ‹‡)

¡ŠÖ”

  abs()       â‘Î’l
  ceil()      Žw’萔’lˆÈã‚Ì‚à‚Á‚Æ‚à¬‚³‚¢’l
  floor()     Žw’萔’lˆÈ‰º‚Ì‚à‚Á‚Æ‚à‘å‚«‚¢’l
  mod()       —]‚è (1 = mod(10, 3))
  round()     ŽlŽÌŒÜ“ü (10.2 = round(10.16, 1))
  sign()      ƒVƒOƒiƒ‹
  sqrt()      ƒXƒNƒGƒAƒ‹[ƒg
  trunc()     Ø‚èŽÌ‚Ä (10.1 = trunc(10.16, 1))
  chr()       ascii •¶Žš‚ð•Ô‚·
  ascii()     •¶Žš‚Ì ascii ƒR[ƒh‚ð•Ô‚·
  concat()    •¶Žš—ñ˜AŒ‹ ('sbcdef' = concat('abc', 'def'))
  lower()     ¬•¶Žš‰»
  upper()     ‘啶Žš‰»
  lpad()      ¶•¶Žš–„‚ß ('000abc' = lpad('abc', 6, '0'))
  rpad()      ‰E•¶Žš–„‚ß ('abc000' = rpad('abc', 6, '0'))
  ltrim()     ¶‹ó”’íœ
  rtrim()     ‰E‹ó”’íœ
  replace()   •¶Žš—ñ’u‚«Š·‚¦ ('ghidef' = replace('abcdef', 'abc', 'ghi'))
  substr()    •¶Žš—ñØ‚èo‚µ ('abc' = substr('abcdef', 1, 3))
  substrb()   “¯ƒoƒCƒg”Å
  instr()     •¶Žš—ñŒŸõ (1 = instr('abcdef', 'abc', 1, 1))
  instrb()    “¯ƒoƒCƒg”Å (ŠJŽnˆÊ’u‚ª•‰‚̏ꍇAŒã‚ë‚©‚猟õ)
  length()    •¶Žš—ñ‚Ì’·‚³
  lengthb()   “¯ƒoƒCƒg”Å
  sysdate()   ƒVƒXƒeƒ€“ú•t (select to_char(sysdate, 'yyyy/mm/dd hh24:mi:ss') now from dual)
  to_char()   ”’l‚©‚當Žš—ñ‚Ö•ÏŠ· ('1,234' = to_chat(1234, '9,999'))
  to_number() •¶Žš—ñ‚©‚琔’l‚Ö•ÏŠ· (1234 = to_number('1234'))

  ** Oracle ŒÅ—L‚̊֐”‚́ASQL-Server ‚Å‚ÍŽg—p‚Å‚«‚Ü‚¹‚ñB

¡WŒvŠÖ”

  avg()       •½‹Ï
  count()     Œ” (count(*) as Œ”)
  sum()       ‡Œv
  max()       Å‘å
  min()       Å¬

¡DDL

  create      ƒe[ƒuƒ‹Aƒrƒ…[AƒL[ì¬
  drop        ƒe[ƒuƒ‹Aƒrƒ…[AƒL[íœ
  alter       ƒe[ƒuƒ‹Aƒrƒ…[AƒL[•ÏX

¡DML

  select      ‘I‘ðƒNƒGƒŠì¬
  insert      ƒf[ƒ^’ljÁ
  update      ƒf[ƒ^C³
  delete      ƒf[ƒ^íœ

¡select ‹å

  from        ƒe[ƒuƒ‹Aƒrƒ…[Žw’è
  where       ’ŠoðŒŽw’è
  group by    WŒvƒOƒ‹[ƒvŽw’è
  having      WŒvŒãAƒOƒ‹[ƒv’ŠoðŒ (having sum(Žó’”) > 300)
  order by    ƒ\[ƒg‡Žw’è (~‡CüŽq: desc)

¡select ƒtƒBƒ‹ƒ^

  distinct    d•¡ƒŒƒR[ƒhœŠO (distinct •i”Ô)

¡SQL Šî‘b•ÒŽ‘—¿
¡SQL Šî‘bŽÀ’n•ÒŽ‘—¿
¡SQL ƒ`ƒ…[ƒjƒ“ƒO•ÒŽ‘—¿
¡Oracle PL/SQL •ÒŽ‘—¿
¡PostgreSQL •ÒAJAVA ServletAJSP •ÒŽ‘—¿
¡MySQL •ÒŽ‘—¿
| 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