Oracle,MySQL,MSSQL ServerºÍAccessÊý¾Ý¿âµÄͳ¼Æº¯Êý
Oracle,MySQL,MSSQL ServerºÍAccessÊý¾Ý¿âµÄͳ¼Æº¯Êý
ÎÒÃÇÔÚ±à³ÌÖг£ÓõÄͳ¼Æº¯ÊýÓмÆÊý,ÇóºÍ,Çó×î´óÖµ,Çó×îСֵ,Çóƽ¾ù,·½²îºÍ±ê×¼²î.
·½²î(Variance)
·½²îÊDZê׼ƫ²îµÄƽ·½¡£×éÖеÄÖµ£¬ÓëËüÃÇƽ¾ùÖµÖ®¼äÆ«Àë³Ì¶ÈµÄ¶ÈÁ¿¡£
±ê׼ƫ²î(Standard Deviation)
Ò»¸ö²ÎÊý£¬Ö¸³öÒ»ÖÖ·½Ê½£¬Ò»¸ö¸ÅÂʺ¯ÊýÒÔÕâÖÖ·½Ê½·Ö²¼ÔÚƽ¾ùÖµ¸½½ü£¬¶øƽ¾ùֵΪ·½²îµÄƽ·½¸ù¡£
ÓÃÀ´ÃèÊöÊýÖµ¼¯ºÏ£¬¼ÆËãÓëËãÊõ¾ùÖµ»òƽ¾ùÖµÖ®¼äµÄ²îÒì¡£
SQLÓï¾äÖеĺ¯ÊýÊDz»·Ö´óСдµÄ¡£
1¡¢COUNT
»ñµÃ¼Ç¼Êý
ËÄÖÖÊý¾Ý¿â¶¼Ò»Ñù,Ó÷¨ÈçÏÂ:
COUNT (*) ·µ»ØÌõ¼þ²éѯ½á¹ûÖÐËùÓмǼµÄÊýÁ¿.
COUNT (ALL expression) ¶Ô×éÖеÄÿһÐж¼¼ÆËã expression ²¢·µ»Ø·Ç¿ÕÖµµÄÊýÁ¿¡£
COUNT (DISTINCT expression) ¶Ô×éÖеÄÿһÐж¼¼ÆËã expression ²¢·µ»ØΨһ·Ç¿ÕÖµµÄÊýÁ¿¡£
2¡¢AVG
ƽ¾ùÖµ
ËÄÖÖÊý¾Ý¿âµÄÓ÷¨Óе㲻һÑù.
AccessºÍMySQL²»Ö§³ÖAVG(distinct expression)²Ù×÷,¶øOracleºÍMS SQL ServerÊÇÖ§³ÖµÄ.
3¡¢MIN, MAX
·Ö±ð·µ»Ø±í´ïʽÖеÄ×îСºÍ×î´óÖµ
ËÄÖÖÊý¾Ý¿âÇø±ð¸úÉÏÃæAVGº¯ÊýÒ»Ñù.
4¡¢Sum
ÇóºÍ
Ó÷¨ÓÐÇø±ð,Ò²ÊÇAccessºÍMySQL²»Ö§³Ö´ødistinctµÄ±í´ïʽÓ÷¨.
5¡¢±ê׼ƫ²îº¯Êý:
ËÄÖÖÊý¾Ý¿âµÄ²î±ð¸ü´óÁË,ÔںܶàµØ·½Ò²ÊDz»ÏàͬµÄ£º
²úÆ·
×ÜÌåÆ«²î
³éÑùÆ«²î
Ó÷¨
˵Ã÷
Access
StDevP()
StDev()
À¨ºÅÖÐÓÃ×Ö¶ÎÃû»òÕß×Ö¶ÎÔËËã±í´ïʽ
²»Ö§³Ö±í´ïʽǰ¼Ódistinct,PÊÇPopulation¡£
MS SQL Server
ͬÉÏ
ͬÉÏ
ͬÉÏ
Ö§³Ö±í´ïʽǰ¼Ódistinct
Oracle
StdDev_Pop()
StdDev()
StdDev_Samp()
ͬÉÏ
Ö§³Ö±í´ïʽǰ¼Ódistinct
MySQL
5.0.3°æÒÔÇ°
Std()
StdDev()
5.0.3°æÒÔºó,¼ÓÈëSTDDEV_POP()
5.0.3°æÒÔÇ°
ÎÞ
5.0.3°æÒÔºó¼ÓÈëSTDDEV_SAMP()
ͬÉÏ
²»Ö§³Ö±í´ïʽǰ¼Ódistinct
6¡¢·½²îº¯Êý:
²úÆ·
×ÜÌåÆ«²î
³éÑùÆ«²î
Ó÷¨
˵Ã÷
Access
VarP()
Var()
À¨ºÅÖÐÓÃ×Ö¶ÎÃû»òÕß×Ö¶ÎÔËËã±í´ïʽ
²»Ö§³Ö±í´ïʽǰ¼Ódistinct
MS SQL Server
ͬÉÏ
ͬÉÏ
ͬÉÏ
Ö§³Ö±í´ïʽǰ¼Ódistinct
Oracle
Var_pop()
var_samp()
variance
ͬÉÏ
Ö§³Ö±í´ïʽǰ¼Ódistinct
MySQL
4.1°æÒÔÇ°
ûÓÐ
5.0.3°æÒÔºó,¼ÓÈëVAR_POP()
5.0.3°æÒÔÇ°
ÎÞ
5.0.3°æÒÔºó¼ÓÈëVAR_SAMP()
ͬÉÏ
²»Ö§³Ö±í´ïʽǰ¼Ódistinct
¡¡¡¡ÎªÁ˸ü¸ßЧµØ²Ù×÷Êý¾Ý¿â£¬ÎÒÃÇÍùÍù¶¼Òª½èÖúÓÚһЩ²Ù×÷¹¤¾ß¡£ÔÚAccessÖУ¬µ±È»¾ÍÊÇÆä±¾ÉíÁË£¬¶øÔÚSQL ServerÖУ¬¿ÉÒÔÓÃÆóÒµ¹ÜÀíÆ÷ºÍ²éѯ·ÖÎöÆ÷À´Íê³ÉÄãÏëÒªÍê³ÉµÄ¹¤×÷£¬¶ÔÓ
Ïà¹ØÎĵµ£º
µÍ³É±¾»ñÈ¡OracleÏà¹ØÈÏÖ¤£¬È«Ãæ¿ìËÙÕÆÎÕOracle¼¼Êõ
ÔÚÆóҵȺÌåÖУ¬È«Çò500Ç¿£¬ÓÐ98%ÔÚʹÓÃOracle¼¼Êõ£»È«ÇòÊ®´óÒøÐоù²ÉÓÃÁËOracleÓ¦ÓÃϵͳ£¬ÔÚÖйú£¬ÅÅÃûÇ°20λµÄÒøÐж¼ÔÚʹÓÃOracle¼¼Êõ£»ÔÚͨÐÅÁìÓò£¬È«Çò20¼Ò¶¥¼¶Í¨ÐŹ«Ë¾È«²¿¶¼ÔÚʹÓÃOracleÓ¦ÓòúÆ·¡£ÔÚÖйú£¬ËùÓеĵçÐÅÓªÔËÉ ......
ÔÚSQLÓï¾äÓÅ»¯¹ý³ÌÖУ¬¾³£»áÓõ½hint,
ÒÔÏÂÊÇÔÚSQLÓÅ»¯¹ý³ÌÖг£¼ûOracleÖÐ"HINT"µÄ30¸öÓ÷¨1. /*+ALL_ROWS*/
±íÃ÷¶ÔÓï¾ä¿éÑ¡Ôñ»ùÓÚ¿ªÏúµÄÓÅ»¯·½·¨,²¢»ñµÃ×î¼ÑÍÌÍÂÁ¿,ʹ×ÊÔ´ÏûºÄ×îС»¯.
ÀýÈç:
SELECT /*+ALL+_ROWS*/ EMP_NO,EMP_NAM,DAT_IN from BSEMPMS WHERE EMP_NO='SCOTT';
2. /*+FIRST_ROWS*/
±íÃ÷¶ÔÓï¾ä¿éÑ¡Ôñ ......
OracleÊý¾Ý¿âSCNºÅÏê½â:
¡¡¡¡ÏµÍ³¼ì²éµãscn(v$database(checkpoint_change#))
¡¡¡¡Êý¾ÝÎļþ¼ì²éµã(v$datafile(checkpoint_change#))
¡¡¡¡Êý¾ÝÎļþÖÕÖ¹scn(v$datafile(last_change#))
¡¡¡¡Êý¾ÝÎļþÖдæ·ÅµÄ¼ì²éµã
¡¡¡¡Æô¶¯scn (v$datafile_header(checkpoint_change#)
¡¡¡¡1¡¢ÏµÍ³¼ì²éµãscn
¡¡¡¡µ±Ò»¸ö¼ì²éµã¶¯×÷Íê³ ......
MySQLÓÐËÄÖÖBLOBÀàÐÍ:
¡¡¡¡·tinyblob:½ö255¸ö×Ö·û
¡¡¡¡·blob:×î´óÏÞÖƵ½65K×Ö½Ú
¡¡¡¡·mediumblob:ÏÞÖƵ½16M×Ö½Ú
¡¡¡¡·longblob:¿É´ï4GB
¡¡¡¡ÔÚÿ¸öMySQLµÄÎĵµ(´ÓMySQL4.0¿ªÊ¼)µÄ½éÉÜÖÐ,Ò»¸ölongblobÁеÄ×î´óÔÊÐí³¤¶ÈÒÀÀµÓÚÔÚ¿Í»§/·þÎñÆ÷ÐÒéÖпÉÅäÖõÄ×î´ó°üµÄ´óСºÍ¿ÉÓÃÄÚ´æÊý¡£
¡¡¡ ......
ÖØװʱ³öÏÖcould not start the service mysql error:0µÄ´íÎóʱ
ÔÚ¿ØÖÆÃæ°åÖÐÔËÐÐÌí¼Óɾ³ý³ÌÐò£¬½«mysqlжÔØ;
жÔغó´ò¿ª×¢²á±í£¬²é¿´HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services ϵļüÖµ£¬Èç¹ûÓÐÏà¹Ømysql¼üÖµ(mysql¡¢mysqladmin)Ôòɾµô£¬¼´¿É;
ÖØÆô£¬½«mysqlµÄ°²×°²ÐÓàĿ¼ɾµô (²é¿´·þÎñ£¬´Ëʱ·þÎñÖÐÒÑû ......