ORACLE SQL³£ÓÃÓÅ»¯·½·¨
1 ²éѯsqlÓÅ»¯
1.1 Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò£¨Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧORACLE£©
½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬Òò´Ëfrom×Ó¾äÖÐдÔÚ×îºóµÄ±í£¨»ù´¡±ídriving table£©½«±»×îÏÈ´¦Àí¡£ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏ£¬Äã±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í¡£µ±ORACEL´¦Àí¶à¸ö±íʱ£¬»áÔËÓÃÅÅÐò¼°ºÏ²¢µÄ·½Ê½Á¬½ÓËüÃÇ¡£Ê×ÏÈ£¬É¨ÃèµÚÒ»¸ö±í£¨from×Ó¾äÖÐ×îºóµÄÄǸö±í£©²¢¶Ô¼Ç¼½øÐÐÅÉÐò£¬È»ºóɨÃèµÚ¶þ¸ö±í£¨from×Ó¾äÖÐ×îºóµÚ¶þ¸ö±í£©£¬×îºó½«ËùÓдӵڶþ¸ö±íÖмìË÷³öµÄ¼Ç¼ÓëµÚÒ»¸ö±íÖкÏÊʼǼ½øÐкϲ¢¡£
ÀýÈ磺±íTAB1 16,384Ìõ¼Ç¼
±íTAB2 1Ìõ¼Ç¼
Ñ¡ÔñTAB2×÷Ϊ»ù´¡±í£¨×îºÃµÄ·½·¨£©
Select count(*) from tab1,tab2 Ö´ÐÐʱ¼ä0.96Ãë
Ñ¡ÔñTAB2×÷Ϊ»ù´¡±í£¨²»¼Ñ·½·¨£©
Select count(*) from tab2,tab1 Ö´ÐÐʱ¼ä26.09Ãë
Èç¹ûÓÐ3¸öÒÔÉϵıíÁ¬½Ó²éѯ£¬ÄǾÍÐèҪѡÔñ½»²æ±í£¨intersection table£©×÷Ϊ»ù´¡±í£¬½»²æ±íÊÇÖ¸ÄǸö±»ÆäËû±íËùÒýÓÃµÄ±í¡£
ÀýÈ磺EMP±íÃèÊöÁËLOCATION±íºÍCATEGORY±íµÄ½»¼¯
SELECT *
from LOCATION L£¬
CATEGORY C£¬
EMP E
WHERE E.EPM_NO BETWEEN 1000 AND 2000
AND E.CAT_NO=C.CAT_NO
AND E.LOCN=L.LOCN
½«±ÈÏÂÁÐSQL¸üÓÐЧÂÊ
SELECT *
from EMP E£¬
LOCATION L£¬
CATEGORY C
WHERE E.EPM_NO BETWEEN 1000 AND 2000
AND E.CAT_NO=C.CAT_NO
AND E.LOCN=L.LOCN
1.2 ¼õÉÙ·ÃÎÊÊý¾Ý¿âµÄ´ÎÊý
µ±Ö´ÐÐÿÌõSQLÓï¾äʱ£¬ORACLEÔÚÄÚ²¿Ö´ÐÐÁËÐí¶à¹¤×÷£º½âÎöSQLÓï¾ä£¬¹ÀËãË÷ÒýµÄÀûÓÃÂÊ£¬°ó¶¨±äÁ¿£¬¶ÁÊý¾Ý¿éµÈµÈ¡£Óɴ˿ɼû£¬¼õÉÙ·ÃÎÊÊý¾ÝµÄ´ÎÊý£¬¾ÍÄÜʵ¼ÊÉϼõÉÙORACLEµÄ¹¤×÷Á¿¡£
ÀýÈ磺
ÒÔÏÂÓÐÈýÖÖ·½·¨¿ÉÒÔ¼ìË÷³ö¹ÍÔ±ºÅµÈÓÚ0342»ò0291µÄÖ°Ô±¡£
·½·¨1£¨×îµÍЧ£©
SELECT EMP_NAME,SALARY,GRADE
from EMP
WHERE EMP_NO=342;
SELECT EMP_NAME,SALARY,GRADE
from EMP
WHERE EMP_NO=29;
·½·¨2£¨¸ßЧ£©
SELECT A.EMP_NAME,A.SALARY,A.GRADE,
B.EMP_NAME,B.SALARY,B.GRADE
FORM EMP A,EMP B
WHERE A.EMP_NO=342
AND B.EMP_NO=29
1.3 ¼õÉÙ¶Ô±íµÄ²
Ïà¹ØÎĵµ£º
Ò»¡¢PL/SQL±à³Ì¹æ·¶Ö®´óСд
¾ÍÏñÔÚSQLÖÐÒ»Ñù£¬PL / SQLÖÐÊDz»Çø·Ö´óСдµÄ¡£ÆäÒ»°ã×¼ÔòÈçÏ£º
¹Ø¼ü×Ö(BEGIN, EXCEPTION, END, IF THEN ELSE,LOOP, END LOOP)¡¢Êý¾ÝÀàÐÍ(VARCHAR2, NUMBER)¡¢ÄÚ²¿º¯Êý(LEAST, SUBSTR)ºÍÓû§¶¨ÒåµÄ×Ó³ÌÐò(procedures, functions,packages)£¬Ê¹Óôóд¡£
±äÁ¿ÃûÒÔ¼°SQLÖеÄÁÐÃûºÍ±íÃû£¬Ê¹ÓÃÐ ......
Ä¿µÄ£ºÍ¨¹ýHTTP·ÃÎÊMS SSAS 2005
ÅäÖ÷½·¨£º
Èç¹ûÏë·ÃÎʶÔÓ¦µÄcube£¬ÔòÐèÖ¸¶¨cubeËùÔڵķþÎñÆ÷Ãû³Æ
ʹ֮¿ÉÒÔͨ¹ýHTTPÐÒé½øÐзÃÎÊ£¬¿ÉÒÔ·µ»ØMDX²éѯËùµÃµ½µÄ½á¹û¼¯ºÍÔªÊý¾Ý
²éѯ½á¹û¼¯µÄ·½·¨ÊÇ£ºExecute()£¬ËüÄܹ»·µ»ØMDXÓï¾äµÄ²éѯ½á¹û
²éѯ½á¹û¼¯ÔªÊý¾Ý·½·¨£ºDiscover()£¬ËüÄܹ»·µ»ØMDXÓï¾äµÄÔªÊý¾ÝÐÅÏ¢¡£¸Ã·½·¨½ÏEx ......
ORACLEÖÐ×ֶεÄÊý¾ÝÀàÐÍ
×Ö·ûÐÍ char ·¶Î§ ×î´ó2000¸ö×Ö½Ú ¶¨³¤
char(10) 'ÕÅÈý' ºóÌí¿Õ¸ñ6¸ö°Ñ10¸ö×Ö½Ú²¹Âú 'ÕÅÈý &nb ......
Êý¾Ý˵Ã÷Ò»ÇУº
create table dept(deptno number,deptname varchar2(20),mgrno number);
insert into dept values (1, '×ܹ«Ë¾', null);
insert into dept values (2, 'Õã½·Ö¹«Ë¾', 1);
insert into dept values (3, 'º¼ÖÝ·Ö¹«Ë¾', 2);
commit;
select t.* from dept t;
DEPTNO &n ......
×î½ü¹¤×÷ÉÔ΢±È½Ï¿ÕÏУ¬±ã°ÑʹÓÃDBCA ´´½¨Êý¾Ý¿âʱµÄÊä³öµÄ½Å±¾ÄÃÀ´Ñо¿Ñо¿£¬²¢²ÎÕսű¾Îļþ£¬ÊÖ¶¯ÊµÏÖÒ»¸öÊý¾Ý¿âµÄ´´½¨¹ý³Ì¡£Ê×ÏÈʹÓÃDBCA¹¤¾ß´´½¨Ò»·Ý½¨¿â½Å±¾£¬Õû¸ö½Å±¾Îļþ°üº¬ÈçÏÂÎļþ£¬
¸Ð¾õÓ¦¸ÃÊÇ´ÓBATÎļþ¿ªÊ¼ÈëÊÖ£¬´ò¿ªBATÎļþ²é¿´ÄÚÈÝÈçÏ£º
mkdir f:\oracle\product\10.2.0\admin\test\adump
mkdir f:\oracl ......