תÔØoracle rollupºÍcubeº¯ÊýʹÓÃÐĵÃ
ʹØCUBE ROLLUP GROUPING SETS£¨1£©
ÔÎÄÒý×Ô£º ¾ÛºÏÊÇÊý¾Ý²Ö¿âµÄ»ù´¡¡£ÎªÁËÌá¸ß¾ÛºÏµÄÐÔÄÜ¡£OracleÌṩÁËGroup By Ìõ¿îµÄÀ©Õ¹¡£
1£® CUBE, ROLLUPÀ©Õ¹
2£® 3¸ögroupingº¯Êý
3£® Grouping setÀ©Õ¹
CUBE ROLLUP GROUPING SETS¶ÔSQLµÄÀ©Õ¹Ê¹µÃ²éѯºÍ±¨¸æ¶¼±äµÃ¼òµ¥ºÍѸËÙ¡£Rollup¼ÆËãÖîÈçsum count max min avgµÄº¯Êý£¬Ôö¼ÓÁ˾ۺϵļ¶±ð.CUBEÊÇÒ»¸öÀàËÆROLLUPµÄÀ©Õ¹£¬Ê¹µÃ¿ÉÒÔÓÃÒ»¸öÓï¾ä¼ÆËãËùÓпÉÄܵľۺϡ£CUBE¿ÉÒÔͨ¹ýµ¥ÌõÉú³ÉCross-tabulation£¨½»²æ±¨±í£©±¨¸æµÄÐÅÏ¢¡£CUBE£¬ROLLUP£¬GROUPING SETSÀ©Õ¹ÁîÄã¿ÉÒÔ¾«È·µÄ¶ÔÄã¸ÐÐËȤµÄgroup by Ìõ¿î½øÐÐgrouping¡£²»ÔËÐÐcube²Ù×÷Ò²¿ÉÒÔ¸ßЧµÄ´Ó¶à¸öά¶È½øÐзÖÎö¡£¼ÆËãÒ»¸öfull cube½«»á´øÀ´ºÜ¸ßµÄ¸ºÔØ£¬ËùÒÔ½«cubeÌ滻Ϊgrouping sets¿ÉÒÔÃ÷ÏÔµØÌá¸ßÐÔÄÜ¡£CUBE ROLLUP GROUPING SETS¿ÉÒÔÉú³Éµ¥¸ö½á¹û¼¯£¬µÈЧÓÚUNION ALL¡£ÎªÁËÌá¸ßÐÔÄÜ£¬CUBE, ROLLUP, and GROUPING SETS¿ÉÒÔ²¢ÐнøÐУº¶à½ø³ÌͬʱÔËËãËùÓеÄÓï¾ä¡£ÕâÖÖ¹¦ÄÜʹµÃ¾ÛºÏ¼ÆËã¸ü¼Ó¸ßЧ£¬Òò´ËÌá¸ßÁËÊý¾Ý¿âÐÔÄܺͿɲâÐÔ¡£
Analyzing Across Multiple Dimensions
¶àά·ÖÎö
ÔÚDSSϵͳÖÐÒ»¸öºÜÖØÒªµÄ¸ÅÄîÊǶàά·ÖÎö£º
´Ó¶à¸ö½Ç¶È¶ÔÆóÒµµÄ×´¿ö½øÐв鿱¡£Demension£¬ÖÚ¶àµÄάһ°ãÊÇʱ¼ä£¬¿Õ¼ä£¬²úÆ·£¬²¿ÃÅ£¬ÇþµÀ£¬ÆóÒµµÄά¶È¶àÖÖ¶àÑù¡£Ê¼þºÍʵÌå¹ØÁªÌض¨µÄά¶È¾ÍÊÇËùνµÄfacts.ÕâЩËùνµÄfacts¿ÉÒÔÊÇÏúÊÛ£¬ÏÖ½ð£¬ÀûÈ󣬿ͻ§ÕË»§£¬»òÊÇÆäËûһЩֵµÃ¼Ç¼µÄ¶«¶«¡£
ÏÂÃæÊÇһЩ¶àάÐèÇóµÄÀý×Ó
1£® չʾ1999ºÍ2000Ä꣬ËùÓвúÆ·µÄ×ÜÏúÁ¿£¬¾ÛºÏ¼¶±ðΪµØÓòά¶È£¬´ÓÖݵ½¹ú¼Òµ½µØÇø¡£
2£® ´´½¨½»²æ±¨±í·ÖÎö1999ºÍ2000ÄêÄÏÃÀÖÞ·¶Î§µÄ·ÑÓ㬰üÀ¨ËùÓеÄС¼Ç
ËùÓеÄÐèÇ󶼰üº¬Á˶àά¡£ºÜ¶à¶àάµÄÎÊÌâÐèÒªÊý¾ÝµÄ¾ÛºÏ£¬Êý¾Ý¼¯µÄ±È½Ï£¬Í¨³£¿çԽʱ¼ä£¬µØÓò¡£
Optimized Performance
²»½ö½öÊǶàάµÄÎÊÌ⣬»¹ÓÐËùÓÐÀàÐ͵Ĵ¦Àí¿ÉÒÔ´ÓÔöÇ¿¾ÛºÏ¹¦ÄÜÖеõ½ºÃ´¦¡£ÊÂÎñµÄ´¦Àí£¬½ðÈÚÖÆÔìϵͳ-ËùÓеÄÕâЩ¶¼²úÉú´óÁ¿µÄÉú²ú±¨¸æÐèÒª´óÁ¿µÄϵͳ×ÊÔ´¡£´´½¨ÕâЩ±¨¸æ¼õÉÙϵͳ¸ºÔØ£¬ÌáÉýÁËϵͳÐÔÄÜ¡£
Ïà¹ØÎĵµ£º
Ë÷Òý
ΨһË÷Òý£º
ÁÐÖÐÎÞÖظ´Öµ£¬Î¨Ò»Ô¼Êø¡£
oracle×Ô¶¯ÎªÖ÷¼üºÍΪһ¼üÁд´½¨Î¨Ò»Ë÷Òý
Óï·¨£ºcreate unique index Ë÷ÒýÃû on ±íÃû(ÁÐÃû);
×éºÏË÷Òý£º
ÔÚ±íÖжà¸ö×Ö¶ÎÉÏ´´½¨µÄË÷Òý
Áа´ÈÎÒâ˳ÐòÅÅÁÐ
where×Ó¾äÖаüº¬¶à¸öÁеIJéѯ£¬¿ÉÌá¸ß·ÃÎÊËٶȡ£
Óï·¨£ºcreate index Ë÷ÒýÃû on ±íÃû(ÁÐÃû1,ÁÐÃû2,...,ÁÐÃûn)£º
·´ ......
¹ØϵÐÍÊý¾Ý¿âÀíÂÛÖÐ×Ö¶ÎÖµ±ØÐëÊǵ¥Öµ£¬¶øoracleÖÐÔÊÐíÔÚÒ»¸ö×Ö¶ÎÖд洢һ¸ö±íµÄÄÚÈÝ¡£
È磺Ա¹¤±íÖеÄÍâ¼ü ²¿ÃűàºÅ£¬oracleÖÐÕâ¸ö×ֶοÉÒÔ´æ·Å²¿ÃŵļǼ¶ø²¢²»ÊÇÒ»¸öÍâ¼ü£¬ÕâÑù²éѯʱºòµÄЧÂÊ»áÌá¸ß¡£
¿É±äÊý×飺
´´½¨´øÓпɱäÊý×éµÄ±í
´´½¨¿É±äÊý×é»ùÀàÐÍ
create or replace type »ùÀàÐÍÃû as object(×Ö¶ÎÇåµ¥);
......
MySQLµÄID·Ç³£·½±ã¶¨Ò壬ֻҪָ¶¨Æä×ֶεÄ×Ô¶¯ÔöÁ¿ÊôÐÔ¼´¿É¡£
µ«ÊÇOracle²»ÐУ¬ÐèÒª¶¨ÒåsequenceºÍtriggedr£¬µ±È»trigger¿ÉÒÔ²»¶¨Ò壬µ«ÊDz»·½±ã¡£
±í¶¨ÒåÈçÏ£º
CREATE TABLE GAME
(
ID
INTEGER ......
ORACLE 10 ѧϰ±Ê¼ÇÃüÁîµÚÒ»¿Î¡£
1.
sqlplus /nolog
connect /as sysdba
alter user scott account unlock;
alter user scott identified by manager;
2.
grant select on dept to nmerp;
revoke select on dept to nmerp;
select * from scott.dept
create table abc(a varchar2(10),b char(10));
alter& ......
²âÊÔ»·¾³»ù±¾ÐÅÏ¢£º
OS£ºWindows XP sp3
DB£ºOracle 9.2.0.1 δÆôÓù鵵
DBÖØ×öÈÕÖ¾Îļþ´óС£º100MB
Ó²ÅÌÐͺţºSAMSUNG HD161GJ£¨SATA-300,160G,7200rpm,8M cache£©
CPU£ºIntel Core2 E8400£¨3.0G£©
Äڴ棺2G
ͨ¹ýHD TuneµÃµ½µÄÓ²ÅÌ»ù±¾²âÊÔÐÅÏ¢£¬
IOPS£º66
¶ÁÈ¡£º90MB/s
дÈ룺82MB/s
² ......