|
|
|
|
²ÀÁö / 2003-04-27 / ¿ÀÈÄ 7:49:25 / 61.75.93.95
Á¶È¸¼ö : 174
|
[Áú¹®] ÀÌ°ÍÁ»..ÇØ°áÇØ Áà¿ä..¤Ð¤Ð |
> Äõ¸®¿¡¼ ¾Æ·¡¿Í °°ÀÌ ÇϸéÀº...
> °á°ú°¡ 0.8ÀÌ ³ª¿Í¾ß Çϴµ¥...
> °á°ú°¡ 0ÀÌ ³ª¿Í¿ä.. ¿Ö ±×·±Áö¿ä..
> ÃÊÂ¥¶ó¼...¤Ð¤Ð
> select (50-10)/50 as minus from sales where title_id='PC8888'
-----------------------------------------------------------
select (50-10)/50
ÀÏ´Ü ÀÌ·¸°Ô Çϸé... ¿ì¸®°¡ »ý°¢ÇÏ´Â °è»êÀ¸·Î´Â 0.8 ÀÌ ³ª¿Í¾ß ¸ÂÁÒ.
±×·±µ¥ DBMS(MSSQL)¿¡¼´Â µ¥ÀÌÅÍ ÇüÀ̶ó´Â °ÍÀÌ ÀÖ°í
ÀÌ¿¡ ±Ù°ÅÇؼ »ý°¢À» Çغ¸¸é
int / int ÀÇ °á°ú´Â int ÀÏ ¼ö ¹Û¿¡ ¾ø½À´Ï´Ù.
µû¶ó¼ ¿øÇÏ´Â °ª 0.8À» ±¸ÇÏ°í ½Í´Ù¸é
¹¬½ÃÀûÀÎ Çüº¯È¯À̳ª, ¸í½ÃÀûÀÎ Çüº¯È¯À» ½ÃÄÑ Áà¾ß ÇÕ´Ï´Ù.
¿©±â¼ ¹¬½ÃÀûÀÎ Çüº¯È¯À̶õ, »ç¿ëÀÚ°¡ ƯÁ¤ º¯È¯ÇÔ¼ö¸¦ ¾²Áö ¾Ê¾Æµµ, ÀÚüÀûÀ¸·Î Çüº¯È¯À» ½ÃÄÑÁÖ´Â °ÍÀ» ÀǹÌÇÕ´Ï´Ù.
int / int = int
int / float = float
int + int = int
int + float = float
int + smallint = int
ÀÌ¿Í°°ÀÌ ¾î´À ÇÑ µ¥ÀÌÅÍ°¡ ´õ Å« ¹üÀ§¿¡ µ¥ÀÌÅÍÇüÀ̶ó¸é °á°ú´Â ±× µ¥ÀÌÅÍÇü¿¡ ¸Â°Ô º¯È¯ÀÌ µÇ¾î Áý´Ï´Ù.
µû¶ó¼
select (50-10)/50 ÀÇ ¿Ã¹Ù¸¥ °ªÀ» ±¸ÇÑ´Ù¸é
select (50-10)/ 50.0 À¸·Î ÇÏ¸é ¿øÇÏ´Â ÇØ´ç °ª 0.8ÀÌ ³ª¿É´Ï´Ù.
¸í½ÃÀûÀÎ Çüº¯È¯Àº
»ç¿ëÀÚ°¡ ƯÁ¤ÇÔ¼ö¸¦ ÀÌ¿ëÇÏ¿© Çüº¯È¯À» ½ÃÅ°´Â °ÍÀ» ÀÇ¹Ì ÇÕ´Ï´Ù.
CAST()³ª CONVERT()ÇÔ¼ö¸¦ ÀÌ¿ëÇÏ¸é µÇ°Ú½À´Ï´Ù.
ÀÚ¼¼ÇÑ ³»¿ëÀº SQL µµ¿ò¸»À» Âü°í ÇÏ¿© º¸¼¼¿ä.
°Ë»ö¾î----------------------------------
"µ¥ÀÌÅÍ Çü½Ä º¯È¯"
"CONVERT"
"CAST"
"NUMERIC"
"DECiMAL" |
|
|
|