sqlÖÐfloorÊÇʲôÒâ˼
sql ÖÐ floor º¯ÊýÓÃÓÚÏòÏÂÉáÈëÊý×Ö»ò±í´ïʽ£¬»ñµÃ×î¿¿½üµÄСÓÚ»ò¼´ÊǸÃÖµµÄÕûÊý¡£Ëü¿ÉÒÔÓÃÓÚÉáÈ븡µãÊý¡¢È·¶¨ÈÕÆÚ»òʱ¼äµÄ½çÏß¡¢ËÄÉáÎåÈëÇ®±ÒÖµÒÔ¼°Ö´ÐÐÇø¼äÅÌÎÊ»ò·Ö×é¡£floor º¯ÊýÓë ceil º¯ÊýÏà·´£¬ºóÕßÏòÉÏÉáÈëÊý×Ö¡£
SQL ÖÐ FLOOR º¯ÊýµÄ¼ÄÒå
FLOOR º¯ÊýÊÇÒ»¸öÄÚÖú¯Êý£¬ÓÃÓÚÏòÏÂÈ¡ÕûÒ»¸öÊý×Ö»ò±í´ïʽµÄÖµ¡£ÕâÒâζ×ÅËü½«Êý×ÖÉáÈëµ½×î¿¿½üµÄСÓÚ»ò¼´ÊǸÃÖµµÄÕûÊý¡£
Óï·¨
FLOOR(expression)
µÇ¼ºó¸´ÖÆ
ÆäÖУº
expression ÊÇҪȡÕûµÄÊý×Ö»ò±í´ïʽ¡£
ʾÀý
SELECT FLOOR(12.5); -- Ч¹û: 12 SELECT FLOOR(-12.5); -- Ч¹û: -13 SELECT FLOOR(12.501); -- Ч¹û: 12
µÇ¼ºó¸´ÖÆ
×÷ÓÃ
FLOOR º¯ÊýÓÃÓÚÖÖÖÖÓ¦ÓóÌÐòÖУ¬ÀýÈ磺
½«¸¡µãÊýÉáÈëΪÕûÊý£¬ÒÔɾ³ýСÊý²¿·Ö¡£
È·¶¨Ò»¸öÈÕÆÚ»òʱ¼äµÄ×îÏÈ»ò¿¢Êµ㡣
ËÄÉáÎåÈëÇ®±ÒÖµ£¬ÒÔ×èֹС¶î²î±ð¡£
Ö´ÐÐÇø¼äÅÌÎÊ»ò·Ö×飬½«Êý¾Ý»®·ÖΪÀëÉ¢µÄÇø¼ä¡£
ÌáÐÑ
FLOOR º¯ÊýÓë CEIL º¯ÊýÏà·´£¬CEIL º¯ÊýÏòÉÏÉáÈëÊý×Ö¡£
FLOOR º¯Êý¿ÉÒÔÓë CAST º¯ÊýÍŽáʹÓã¬ÒÔ½«Êý×ÖÇ¿ÖÆת»»ÎªÕûÊý¡£
FLOOR º¯Êý¶Ô¸ºÊýÓÐÓ㬵«»áÏòÏÂÉáÈëµ½×î¿¿½üµÄ½ÏСµÄÕûÊý¡£
ÒÔÉϾÍÊÇsqlÖÐfloorÊÇʲôÒâ˼µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡