Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Oracleѧϰ±Ê¼Çժ¼4

 ½¨Á¢±íÈçÏÂ:
ѧÉú»ù±¾ÐÅÏ¢±í
CREATE Student(
[Studentid][Int]IDENTITY(1,1)NOT NULL primary key,--Ö÷¼ü
[StudentName][char]NOT NULL
)
¿Î³ÌÐÅÏ¢±í
CREATE Subject(
[SubjectID][char]NOT NULL primary key,          --Ö÷¼ü
[SubjectName][char]NOT NULL
)
³É¼¨±í
CREATE Grade(
[Studentid][Int]NOT NULL,        --ÁªºÏÖ÷¼ü
[SubjectID][char]NOT NULL,        --ÁªºÏÖ÷¼ü
[Grade] [INT]NOT NULL,
primary key (studentid,subjectid)
)
1.½«½¨±íÃüÁî¸ÄΪORACLEÓï¾äÔÚORACLEÖн¨±í
create table student( --ѧÉú±í
studentid number(3) primary key, --ѧÉú±àºÅ
studentname varchar2(20) --ѧÉúµÄÐÕÃû
);
create table subject( --¿Î³Ì±í
subjectid char(3) primary key, --¿Î³Ì±àºÅ
subjectname varchar2(20)  --¿Î³ÌµÄÃû×Ö
);
create table grade( --·ÖÊý±í
studentid number(3) references student(studentid), --ѧÉúid
subjectid char(3) references subject(subjectid), --¿Î³Ìid
mark      number(3), --·ÖÊý
primary key (studentid,subjectid) --ÁªºÏÖ÷¼ü
);
insert into student values (101,'ÕÅÈý');
insert into student values (102,'ÀîÔÆ');
insert into student values (103,'δ');
insert into subject values ('A01','C++');
insert into subject values ('A02','ASP');
insert into subject values ('A03','JAVA');
insert into grade values (101,'A01',59);
insert into grade values (101,'A02',72);
insert into grade values (101,'A03',90);
insert into grade values (102,'A01',75);
insert into grade values (102,'A02',91);
insert into grade values (103,'A01',71);
2.×÷ÈçÏÂ4Ìâ
µÚÒ»ÎÊ£º²éѯ³öÒÔÏÂÐÅÏ¢
ѧºÅ ѧÉúÐÕÃû ¿Î³ÌÃû³Æ ³É¼¨ £¨ÒªÈ«²¿Ñ§ÉúÐÅÏ¢£©
¹ØÁª²éѯ (¶àÕűíµÄ)
±ðÃû
select a.studentid as "ѧ  ºÅ",studentname "ѧÉúÐÕÃû",
subjectname "¿Î³ÌÃû³Æ",mark "³É  ¼¨"
from student a , subject b , grade c
where a.studentid = c.studentid
and b.subjectid = c.subjectid;
[select a.studentid "ѧ  ºÅ",studentname &q


Ïà¹ØÎĵµ£º

Oracle SQLµÄÓ²½âÎöºÍÈí½âÎö


 
˵µ½Èí½âÎö£¨soft prase£©ºÍÓ²½âÎö£¨hard prase£©£¬¾Í²»Äܲ»ËµÒ»ÏÂOracle¶ÔsqlµÄ´¦Àí¹ý³Ì¡£µ±Äã·¢³öÒ»ÌõsqlÓï¾ä½»¸¶Oracle£¬ÔÚÖ´ÐкͻñÈ¡½á¹ûÇ°£¬Oracle¶Ô´Ësql½«½øÐм¸¸ö²½ÖèµÄ´¦Àí¹ý³Ì£º
    1¡¢Óï·¨¼ì²é£¨syntax check£©
    ¼ì²é´ËsqlµÄƴдÊÇ·ñÓï ......

Oracleѧϰ±Ê¼Çժ¼6


  declare
  begin
   --SQLÓï¾ä
   --Ö±½ÓдµÄSQLÓï¾ä(DML/TCL)
   --¼ä½Óдexecute immediate <DDL/DCLÃüÁî×Ö·û´®>
   --select Óï¾ä
        <1>±ØÐë´øÓÐinto×Ó¾ä
      &n ......

MySQLºÍOracleµÄһЩ²Ù×÷Çø±ð

 ÓкܶàÓ¦ÓÃÏîÄ¿, ¸ÕÆð²½µÄʱºòÓÃMYSQLÊý¾Ý¿â»ù±¾ÉÏÄÜʵÏÖ¸÷ÖÖ¹¦ÄÜÐèÇó£¬Ëæ×ÅÓ¦ÓÃÓû§µÄÔö¶à£¬Êý¾ÝÁ¿µÄÔö¼Ó£¬MYSQL½¥½¥µØ³öÏÖ²»¿°ÖظºµÄÇé¿ö£ºÁ¬½ÓºÜÂýÉõÖÁå´»ú£¬ÓÚÊǾÍÓаÑÊý¾Ý´ÓMYSQLǨµ½ORACLEµÄÐèÇó£¬Ó¦ÓóÌÐòÒ²ÒªÏàÓ¦×öһЩÐ޸ġ£±¾ÈË×ܽá³öÒÔϼ¸µã×¢ÒâÊÂÏϣÍû¶Ô´ó¼ÒÓÐËù°ïÖú¡£
1£® ×Ô¶¯Ôö³¤µÄÊý¾ ......

OracleʹÓõÄhintsµ÷Õû»úÖÆ

 
10gÊý¾Ý¿â½éÉÜ£º¿ÉÒÔʹÓøü¶àеÄoptimizer hintsÀ´¿ØÖÆÓÅ»¯ÐÐΪ¡£ÏÖÔÚÈÃÎÒÃÇ¿ìËÙ½âÎöÒ»ÏÂÕâЩǿ´óµÄÐÂhints:
spread_min_analysis

ʹÓÃÕâÒ»hint£¬Äã¿ÉÒÔºöÂÔһЩ¹ØÓÚÈçÏêϸµÄ¹ØϵÒÀÀµÍ¼·ÖÎöµÈµç×Ó±í¸ñµÄ±àÒëʱ¼äÓÅ»¯¹æÔò¡£ÆäËûµÄһЩÓÅ»¯£¬Èç´´½¨¹ýÂËÒÔÓÐÑ¡ÔñÐԵĶ¨Î»µç×Ó±í¸ñ·ÃÎʽṹ²¢ÏÞÖÆÐÞ¶©¹æÔòµÈ£¬µÃµ ......

Oracleѧϰ±Ê¼Çժ¼2

    µ¥Ðк¯Êý   ·µ»ØÖµÖ»ÓÐÒ»¸ö
      
   ·Ö×麯Êý   ·µ»ØÖµÊǶàÌõ¼Ç¼
      group by
      sum
      avg         ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ