OracleÖÐSQL PLUSµÄ³£ÓÃÖ¸Áî
½øÈësql*plusÐèÒªÊäÈëÓû§Ãû¡¢¿ÚÁîºÍÖ÷»ú±êÖ¾·û
system/manager
sys/change_on_intall
scott/tiger
internal/oracle
ÒÔÉÏΪ³õʼÃÜÂë
Ö÷»ú×Ö·û´®¿Õ»òÕßÊÇ@+ÄãµÄ·þÎñÃû,ÔÚ±¾µØµÇ½²»ÐèÒª±¾µØ·þÎñÃû¡£
ÏÂÃæ¾Í½éÉÜÒ»ÏÂһЩ³£ÓõÄsql*plusÃüÁ
Ê×ÏȲ鿴µ±Ç°Ê¹ÓõÄÊý¾Ý¿âʵÀý:
select name from V$database;
Çл»Á½¸öÊý¾Ý¿âʵÀý
ÔÚsqlplusÀïconnect username/password@sid
»òhost set ORACLE_SID=sid
»òcmdÀïset ORACLE_SID=sid
»òÐÞ¸Ä×¢²á±íÀïORACLE_SIDÏî
¡ô1. Ö´ÐÐÒ»¸öSQL½Å±¾Îļþ
SQL>start file_name
SQL>@ file_name
ÎÒÃÇ¿ÉÒÔ½«¶àÌõsqlÓï¾ä±£´æÔÚÒ»¸öÎı¾ÎļþÖУ¬ÕâÑùµ±ÒªÖ´ÐÐÕâ¸öÎļþÖеÄËùÓеÄsqlÓï¾äʱ£¬ÓÃÉÏÃæµÄÈÎÒ»ÃüÁî¼´¿É£¬ÕâÀàËÆÓÚdosÖеÄÅú´¦Àí¡£
¡ô2. ¶Ôµ±Ç°µÄÊäÈë½øÐбà¼
SQL>edit
¡ô3. ÖØÐÂÔËÐÐÉÏÒ»´ÎÔËÐеÄsqlÓï¾ä
SQL>/
¡ô4. ½«ÏÔʾµÄÄÚÈÝÊä³öµ½Ö¸¶¨Îļþ
SQL> SPOOL file_name
ÔÚÆÁÄ»ÉϵÄËùÓÐÄÚÈݶ¼°üº¬ÔÚ¸ÃÎļþÖУ¬°üÀ¨ÄãÊäÈëµÄsqlÓï¾ä¡£
¡ô5. ¹Ø±ÕspoolÊä³ö
SQL> SPOOL OFF
Ö»ÓйرÕspoolÊä³ö£¬²Å»áÔÚÊä³öÎļþÖп´µ½Êä³öµÄÄÚÈÝ¡£
¡ô6£®ÏÔʾһ¸ö±íµÄ½á¹¹
SQL> desc table_name
¡ô7. COLÃüÁ
Ö÷Òª¸ñʽ»¯ÁеÄÏÔʾÐÎʽ¡£
¸ÃÃüÁîÓÐÐí¶àÑ¡Ï¾ßÌåÈçÏ£º
COL[UMN] [{ column|expr} [ option ...]]
OptionÑ¡Ïî¿ÉÒÔÊÇÈçϵÄ×Ó¾ä:
ALI[AS] alias
CLE[AR]
FOLD_A[FTER]
FOLD_B[EFORE]
FOR[MAT] format
HEA[DING] text
JUS[TIFY] {L[EFT]|C[ENTER]|C[ENTRE]|R[IGHT]}
LIKE { expr|alias}
NEWL[INE]
NEW_V[ALUE] variable
NOPRI[NT]|PRI[NT]
NUL[L] text
OLD_V[ALUE] variable
ON|OFF
WRA[PPED]|WOR[D_WRAPPED]|TRU[NCATED]
1). ¸Ä±äȱʡµÄÁбêÌâ
COLUMN column_name HEADING column_heading
For example:
Sql>select * from dept;
DEPTNO DNAME LOC
---------- ---------------------------- ---------
10 ACCOUNTING NEW YORK
sql>col LOC heading location
sql>select * from dept;
DEPTNO DNAME location
--------- ---------------------------- -----------
10 ACCOUNTING NEW YORK
2). ½«ÁÐÃûENAME¸ÄΪÐÂÁÐÃûEMPLOYEE NAME²¢½«ÐÂÁÐÃû·ÅÔÚÁ½ÐÐÉÏ£º
Sql>select * from emp
Department name Salary
---------- ---------- ----------
10 aaa 11
SQL> COLUMN ENAME HEADING ’Employee|Name’
Sql>select * from
Ïà¹ØÎĵµ£º
---------------------------------------------------------------------------
---- ±¾ÎÄΪandkylee¸öÈËÔ´´£¬ÇëÔÚ×ðÖØ×÷ÕßÀͶ¯³É¹ûµÄÇ°ÌáϽøÐÐתÔØ£»
---- תÔØÎñ±Ø×¢Ã÷Ôʼ³ö´¦
:
http://blog.csdn.net/andkylee
--- 2010-05-31 22:56:43
---- ¹Ø¼ü×Ö£º oracle ·ÖÒ³ rownum
--------------------------------- ......
Õû¸öSQLºÍAsp.net(vb.net)Ò»Æð´ò°üµÄÈ«¹ý³ÌдһÏ¡£
Ò».×¼±¸±ØÒªµÄÎļþ
1. SQL½Å±¾Îļþ£¬Éú³ÉÒÔºó°²×°¹ý³ÌÖÐÐèÒªµÄ±íºÍ´æ´¢¹ý³ÌµÈµÈ£»
Éú³ÉÖ®ºó£¬¾ÍÔÝʱ°ÑËüÃüÃûΪdb.sql(×¢Òâ´óСд)
2.LisenceFile.rtfµÄ°²×°Îļþ£¬ÒòΪÎÒµÄϵͳÊǸöÈ˵ģ¬¶øÇÒfreeµÄ£¬ËùÒÔ¾ÍûÓÐ×ö¡£Õâ¸öÒÔºóÒ²ÊÇÒªÓõ½µÄ¡£
¶þ.ÔÚ×Ô¼ºÏÖÓеÄÏîÄ¿Àïà ......
SQL ServerÈ«ÎÄË÷ÒýµÄ¸öÈË×ܽá(ÉÏ) -¹ØÓÚÖÐÎÄ·Ö´Ê
(2005-11-14 04:29:44)
תÔØ
·ÖÀࣺÉî¶ÈÑо¿
´ó¼Ò¶¼ÖªµÀLIKE²éѯºÜÂý£¬È«ÎÄË÷Òý¾ÍÊÇÊÂÏÈ×öºÃÏà¹ØµÄË÷Òý£¬±íʾÄĸöÖ÷Ìâ´Ê¿ÉÒÔÔÚÄÄЩ¼Ç¼ÀïÕÒµ½£¬ÉõÖÁÊÂÏȼÆËãºÃRANK£¬¼ìË÷ʱ¿ÉÒÔ°ÑÏà¹Ø¶È¸ßµÄÏÈÁгöÀ´£¬Õâ¿ÉÒÔ´ó´óÌá¸ß¼ìË÷µÄËٶȡ£
´ò¸ö±È·½£¬ÄãÓÐ ......
---Ò»¸öÔµĵÚÒ»Ìì
SELECT DATEADD(mm, DATEDIFF(mm,0,getdate()), 0)
--- ±¾ÖܵÄÐÇÆÚÒ»
SELECT DATEADD(wk, DATEDIFF(wk,0,getdate()), 0)
---Ò»ÄêµÄµÚÒ»Ìì
SELECT DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)
----¼¾¶ÈµÄµÚÒ»Ìì
SELECT DATEADD(qq, DATEDIFF(qq,0,getdate()), 0)
----ÉϸöÔµÄ×îºóÒ»Ìì
......
ÐÐÁÐת»»
create table test(id int,name varchar(20),quarter int,profile int)
insert into test values(1,'a',1,1000)
insert into test values(1,'a',2,2000)
insert into test values(1,'a',3,4000)
insert into test values(1,'a',4,5000)
insert into test values(2,'b',1,3000)
insert into test values(2, ......