Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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ѧϰ±Ê¼Çժ¼3

 ¡¶1¡·DDLÓï¾ä(Êý¾Ý¶¨ÒåÓïÑÔ) Data Define Language
   create
   alter
   drop
   truncate ¿ªÍ·µÄÓï¾ä truncate table <±íÃû>
      Ìصã:<1>½¨Á¢ºÍÐÞ¸ÄÊý¾Ý¶ÔÏó
         &nb ......

Oracleѧϰ±Ê¼Çժ¼6


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

Javaµ÷ÓÃOracleÊý¾Ý¿âµÄ·ÖÒ³´æ´¢¹ý³Ì

 ×î½üÏîÄ¿½ø¶È±È½Ï»ºÂý£¬³õ²½Ñо¿ÁËÒ»ÏÂOracleµÄ´æ´¢¹ý³Ì£¬½«´úÂëÌù³öÀ´¡£
 Ê×ÏÈÏÈÌù³öÀ´OracleµÄ·ÖÒ³·ÖÒ³´æ´¢¹ý³Ì´úÂë°É¡£
 1.ÕâÊÇ°üµÄ´úÂë
 create or replace package DB_Oper is
  -- Author  : LIUBING
  -- Created : 2009-10-28 15:01:30
  -- Purpose : ²âÊÔOracleµ ......

OracleÊý¾Ý¿â±¸·ÝÓë»Ö¸´µÄÈýÖÖ·½·¨


OracleÊý¾Ý¿âÓÐÈýÖÖ±ê×¼µÄ±¸·Ý·½·¨£¬ËüÃÇ·Ö±ðÊǵ¼³ö£¯µ¼È루EXP/IMP£©¡¢Èȱ¸·ÝºÍÀ䱸·Ý¡£µ¼³ö±¸¼þÊÇÒ»ÖÖÂß¼­±¸·Ý£¬À䱸·ÝºÍÈȱ¸·ÝÊÇÎïÀí±¸·Ý¡£
Ò»¡¢ µ¼³ö£¯µ¼È루Export£¯Import£©
ÀûÓÃExport¿É½«Êý¾Ý´ÓÊý¾Ý¿âÖÐÌáÈ¡³öÀ´£¬ÀûÓÃImportÔò¿É½«ÌáÈ¡³öÀ´µÄÊý¾ÝËͻص½OracleÊý¾Ý¿âÖÐÈ¥¡£
£±¡¢ ¼òµ¥µ¼³öÊý¾Ý£¨Export£©ºÍµ¼ ......

oracleÖÐrownumµÄÓ÷¨

 
rownum ÕæµÄÊǺܺõĶ«Î÷£¬ÏÖÔÚ´ó¶àÊýÓÃÓÚ´æ´¢¹ý³Ì·ÖÒ³. µ«ÔõôÓÃÄØ£¿Õâ¾ÍÀ´Ñо¿Ò»Ï¡£ ºÙºÙ
--- ÒÔÏÂΪתÔØÖ®´¦£¬½ö¹©Ñ§Ï°
¶ÔÓÚrownumÀ´ËµËüÊÇoracleϵͳ˳Ðò·ÖÅäΪ´Ó²éѯ·µ»ØµÄÐеıàºÅ£¬·µ»ØµÄµÚÒ»ÐзÖÅäµÄÊÇ1£¬µÚ¶þÐÐÊÇ2£¬ÒÀ´ËÀàÍÆ£¬Õâ¸öα×ֶοÉÒÔÓÃÓÚÏÞÖƲéѯ·µ»ØµÄ×ÜÐÐÊý£¬¶øÇÒrownum²»ÄÜÒÔÈκαíµÄà ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ