MS-SQL > ¼ýÀÚ °ü·Ã ÇÔ¼ö µî·ÏÀÏ : 2017-06-30 17:45 Á¶È¸¼ö : 52,759¾È³çÇϼ¼¿ä.
¿À´ÃÀº ¼ýÀÚ¿¡ °ü·ÃµÈ ÇÔ¼ö¸¦ Á¤¸®ÇØ º¸°íÀÚ ÇÕ´Ï´Ù. 1. AVG,COUNT,MAX,MIN,SUM() SELECT AVG(total),COUNT(total),MAX(total),MIN(total),SUM(total) FROM Å×À̺í¸í Æò±Õ,°¹¼ö,ÃÖ´ë°ª,ÃÖ¼Ò°ª,ÇÕ°è µîµîÀ» Ãâ·ÂÇÒ ¼ö ÀÖ´Ù. 2. ABS() ABSÇÔ¼ö´Â Àý´ë°ªÀ» ³ªÅ¸³»ÁÝ´Ï´Ù. SELECT ABS(-100),ABS(100) °á°ú -> 100 100 3. POWER() POWERÇÔ¼ö´Â Á¦°ö±ÙÀ» Ç¥ÇöÇØÁÝ´Ï´Ù. Çü½Ä: POWER(¼ýÀÚ°ª, ½Â¼ö°ª) SELECT POWER(2,2),POWER(2,3),POWER(2,8) °á°ú -> 4 8 256 4. SQRT() SQRT´Â ·çÆ®°ªÀ» Ç¥ÇöÇØÁÝ´Ï´Ù. Çü½Ä: SQRT(¼ýÀÚ°ª) SELECT SQRT(2),SQRT(100),SQRT(4) °á°ú -> 1.4142135623730951 10.0 2.0 5. RAND() RAND´Â 0 ¿¡¼ 1»çÀÌÀÇ ³¼ö¸¦ ¹ß»ý½Ãŵ´Ï´Ù. Çü½Ä: RAND() SELECT RAND() 6. ROUND() ROUND´Â ¹Ý¿Ã¸² ÇÔ¼öÀÔ´Ï´Ù. Çü½Ä: ROUND(¼ýÀÚ, ÀÚ¸´¼ö) SELECT ROUND(123.4567,3) SELECT ROUND(123.4567,2) SELECT ROUND(123.4567,1) SELECT ROUND(123.4567,0) SELECT ROUND(123.4567,-1) SELECT ROUND(123.4567,-2) °á°ú -------------------------------- 123.4570 123.4600 123.5000 123.0000 120.0000 100.0000 7. CEILING, FLOOR() CEILINGÀº ¼Ò¼öÁ¡ ù¹ø° °ªÀ» ±âÁØÀ¸·Î ¿Ã¸²À» ÇÏ°í FLOOR´Â ¼Ò¼öÁ¡ ù¹ø° °ªÀ» ±âÁØÀ¸·Î ³»¸²À» ÇÕ´Ï´Ù. Çü½Ä: CEILING(¼ýÀÚ) ... FLOORµµ µ¿ÀÏ CEILING°ú FLOOR´Â ¼Ò¼ö ù¹ø°°ªÀÌ 5 ÀÌ»óÀ̵ç ÀÌÇϵ簣¿¡ ¹«Á¶°Ç ¿Ã¸², ³»¸²À» ¼öÇàÇÕ´Ï´Ù. 8. isnumeric(aa) AAÀÇ °ªÀÌ ¼ýÀÚ¸¸À¸·Î ÀÌ·ç¾îÁ® ÀÖÀ¸¸é 1, ±×·¸Áö ¾ÊÀ¸¸é 0À» ¸®ÅÏÇÕ´Ï´Ù. select * from theme1 where isnumeric(pwd)=1 À§ÀÇ Äõ¸®´Â PWD Çʵ尡 ¼ýÀڷθ¸ µÇ¾î ÀÖ´Â °ªµéÀ» ºÒ·¯¿À´Â ¿¹Á¦ÀÔ´Ï´Ù. 9. ROUND() - ¹Ý¿Ã¸² SELECT ROUND(12.35393,2) --> °á°ú°ª : 12.35000 SELECT ROUND(12.35593,2) --> °á°ú°ª : 12.36000 SELECT ROUND(12.35393,-1) --> °á°ú°ª : 10.00000 SELECT ROUND(15.35393,-1) --> °á°ú°ª : 20.00000 SELECT ROUND(12.35393,0) --> °á°ú°ª : 12.00000 -ÀÚ¸£±â Select Round(98.65, 1, 1) --> °á°ú°ª : 98.60 Select Round(98.65, 0, 1) --> °á°ú°ª : 98.00 Select Round(98.65, -1, 1) --> °á°ú°ª : 90.00 10. CEILING() - ¿Ã¸² SELECT CEILING(12.35393) --> °á°ú°ª : 13 SELECT CEILING(-12.35393) --> °á°ú°ª : -12 SELECT CEILING(0.00) --> °á°ú°ª : 0 11. FLOOR() - ³»¸² SELECT FLOOR(12.35393) --> °á°ú°ª : 12 SELECT FLOOR(-12.35393) --> °á°ú°ª : -13 SELECT FLOOR(0.00) --> °á°ú°ª : 0
|