Oracleѧϰ±Ê¼Çժ¼8
<1> ORACLEµÄʹÓÃ
Æô¶¯ºÍ¹Ø±Õ
¹¤¾ß²Ù×÷ORACLE -- sql*plus
plsql developer
<2> SQLÃüÁî
4´óÀà
DDL Êý¾Ý¶¨ÒåÓïÑÔ - ½¨Á¢Êý¾Ý¿â¶ÔÏó
create /alter/ drop/ truncate
DML Êý¾Ý²Ù×ÝÓïÑÔ - Êý¾ÝµÄ²é¿´ºÍά»¤
select / insert /delete /update
TCL ÊÂÎñ¿ØÖÆÓïÑÔ - Êý¾ÝÊÇ·ñ±£´æµ½Êý¾Ý¿âÖÐ
commit / rollback / savepoint
DCL Êý¾Ý¿ØÖÆÓïÑÔ -- ²é¿´¶ÔÏóµÄȨÏÞ
grant / revoke /ÈçºÎ½¨Óû§
<3> ×Ó²éѯºÍ¹ØÁª²éѯ *********************
¹ØÁª²éѯ - 3¸ö±íµÄ¹ØÁª
select dname,ename
from dept a, emp b
where a.deptno = b.deptno;
×Ó²éѯ -- (1)дÔÚwhere×Ó¾äÖÐ
(2) ×Ó²éѯ¿ÉÒÔ³öÏÖÔÚ×ֶεÄλÖÃÉÏ
(1) select * from emp where sal > (
select avg(sal) from emp );
--¸ßÓÚƽ¾ù¹¤×ʵÄËùÓÐÔ±¹¤
(2) select * from emp a where sal > (
&
Ïà¹ØÎĵµ£º
declare
begin
--SQLÓï¾ä
--Ö±½ÓдµÄSQLÓï¾ä(DML/TCL)
--¼ä½Óдexecute immediate <DDL/DCLÃüÁî×Ö·û´®>
--select Óï¾ä
<1>±ØÐë´øÓÐinto×Ó¾ä
&n ......
±¾ÎÄÏêϸµÄ½éÉÜÁËOracleÊý¾Ý¿â½ÏºÃµÄÊ®ÖÖÖØÐÂÆô¶¯²½Öè¡£
¡¡¡¡1. Í£Ó¦ÓòãµÄ¸÷ÖÖ³ÌÐò¡£
¡¡¡¡2. Í£oralceµÄ¼àÌý½ø³Ì:
¡¡¡¡$lsnrctl stop
¡¡¡¡3. ÔÚ¶ÀÕ¼µÄϵͳÓû§Ï£¬±¸·Ý¿ØÖÆÎļþ:
¡¡¡¡SQL>alter database backup controlfile to trace;
¡¡¡¡4. ÔÚ¶ÀÕ¼µÄϵͳÓû§Ï£¬ÊÖ¹¤Çл»ÖØ×÷ÈÕÖ¾Îļþ£¬È·±£µ±Ç°ÒÑÐ޸Ĺýµ ......
Àý£º
create user his identified by his default tablespace users temporary tablespace temp;
grant connect,resource,dba to his;
create tablespace his
logging
datafile 'd:\oracle\product\10.2.0\oradata\zjxsh\his.ora' size 100M extent
management local segment space management auto;
exp his/ny@ny ......
½¨Á¢±íÈçÏÂ:
ѧÉú»ù±¾ÐÅÏ¢±í
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
)
³ ......
Êý¾Ý¿â¶ÔÏó
<1>±í(Ô¼Êø)
<2>ÈçºÎ×Ô¶¯±àºÅ
SQLserver
--IDENTITYÊôÐÔ
create table test(
xh int identity(1,2) primary key,
name varchar(20)
);
insert into test(name) values ('mike');
ORACLE
Ò»¸ö¶ÔÏó(ÐòÁÐsequenc ......