oracle ³£Óú¯Êý
1. select * from emp;
2. select empno, ename, job from emp;
3. select empno ±àºÅ, ename ÐÕÃû, job ¹¤×÷ from emp;
4. select job from emp;
5. select distinct job from emp;
6. select distinct empno, job from emp;
˵Ã÷:ÒòΪ¹ÍÔ±±àºÅ²»Öظ´, ËùÒÔ´Ëʱ֤Ã÷ËùÓеÄÁÐûÓÐÖظ´,ËùÒÔ²»ÄÜÏû³ýµôÖظ´µÄÁÐ.
7. ²éѯ³ö¹ÍÔ±µÄ±àºÅ, ÐÕÃû, ¹¤×÷, µ«ÊÇÏÔʾµÄ¸ñʽ:±àºÅÊÇ: 7369 µÄ¹ÍÔ±, ÐÕÃûÊÇ: smith, ¹¤×÷ÊÇ: clear
select '±àºÅÊÇ: ' || empno || 'µÄ¹ÍÔ±, ÐÕÃûÊÇ: ' || ename || ', ¹¤×÷ÊÇ: ' || job from emp;
8. Çó³öÿ¸ö¹ÍÔ±µÄÐÕÃû¼°Äêн
select ename, sal * 12 income from emp;
9. Çó³ö¹¤×Ê´óÓÚ 1500 µÄËùÓйÍÔ±ÐÅÏ¢
select * from emp where sal > 1500;
10. ²éѯÿÔ¿ÉÒԵõ½½±½ðµÄ¹ÍÔ±ÐÅÏ¢
select * from emp where comm is not null;
11. ²éѯûÓн±½ðµÄ¹ÍÔ±ÐÅÏ¢
select * from emp where comm is null;
12. ²éѯ³ö»ù±¾¹¤×Ê´óÓÚ 1500 ͬʱ¿ÉÒÔÁìÈ¡½±½ðµÄ¹ÍÔ±ÐÅÏ¢
select * from emp where sal > 1500 and comm is not null;
13. ²éѯ³ö»ù±¾¹¤×Ê´óÓÚ 1500 »òÕß¿ÉÒÔÁìÈ¡½±½ðµÄ¹ÍÔ±ÐÅÏ¢
select * from emp where sal > 1500 or comm is not null;
14. ²éѯ³ö»ù±¾¹¤×ʲ»´óÓÚ 1500 »òÕß²»¿ÉÒÔÁìÈ¡½±½ðµÄ¹ÍÔ±ÐÅÏ¢
select * from emp where not(sal > 1500 and comm is not null);
15. ²éѯ»ù±¾¹¤×Ê´óÓÚ 1500, µ«ÊÇСÓÚ 3000 µÄÈ«²¿¹ÍÔ±ÐÅÏ¢
select * from emp where sal > 1500 and sal < 3000;
16. ²éѯ»ù±¾¹¤×Ê´óÓÚµÈÓÚ 1500, µ«ÊÇСÓÚµÈÓÚ 3000 µÄÈ«²¿¹ÍÔ±ÐÅÏ¢
select * from emp where sal >= 1500 and sal <= 3000;
select * from emp where sal between 1500 and 3000;
17. ²éѯ³öÔÚ 1981 Äê¹ÍÓ¶µÄÈ«²¿¹ÍÔ±ÐÅÏ¢(1981 Äê 1 Ô 1 ÈÕ µ½ 1981 Äê 12 Ô 31 ÈÕÖ®¼äµÄ¹ÍÓ¶µÄ¹ÍÔ±)
select * from emp where hiredate between '1-1ÔÂ-81' and '31-12ÔÂ-81';
18. ÒªÇó²éѯ³öÐÕÃûÊÇ smith µÄ¹ÍÔ±ÐÅÏ¢
select * from emp where ename = 'SMITH';
19. ÒªÇó²éѯ³ö¹ÍÔ±ÊÇ 7369, 7499, 7521 µÄ¹ÍÔ±µÄ¾ßÌåÐÅÏ¢
select * from emp where empno = 7369 or empno = 7499 or empno = 7521;
select * from emp where empno in(7369, 7499, 7521);
20. ÒªÇó²éѯ³ö¹ÍÔ±²»ÊÇ 7369, 7499, 7521 µÄ¹ÍÔ±µÄ¾ßÌåÐÅÏ¢
select * from emp where empno not in(7369, 7499, 7521);
Ïà¹ØÎĵµ£º
create or replace java source named FirstClass as
public class FirstClass{
public static String greeting(String name){
return "Hello " + name + "!";
}
}
/
create or replace function firstclass_greeting (name varchar2) ret ......
ÔÚ$ORACLE_HOME/sqlplus/admin/login.sql (»òÕßÊÇglogin.sql)ÖÐÌí¼Ó£º
set termout off
COLUMN prompter new_value m_prompt
select host_name || ':' || instance_name ||' >' prompter
from sys.v_$insta ......
OracleÉó¼Æ¹¦ÄÜ
Éó¼ÆÊǶÔÑ¡¶¨µÄÓû§¶¯×÷µÄ¼à¿ØºÍ¼Ç¼£¬Í¨³£ÓÃÓÚ£º
u Éó²é¿ÉÒɵĻ¡£ÀýÈ磺Êý¾Ý±»·ÇÊÚȨÓû§Ëùɾ³ý£¬´Ëʱ°²È«¹ÜÀíÔ±¿É¾ö¶¨¶Ô¸Ã Êý¾Ý¿âµÄËùÓÐÁ¬½Ó½øÐÐÉó¼Æ£¬ÒÔ¼°¶ÔÊý¾Ý¿âµÄËùÓбíµÄ³É¹¦µØ»ò²»³É¹¦µØɾ³ý½øÐÐÉó¼Æ¡£
u &n ......
rlwrapʹÓ÷½·¨
¹Ø¼ü×Ö: rlwrapʹÓ÷½·¨
ÔÚWindows²Ù×÷ϵͳÉÏ,µ±ÔÚDOSÃüÁî´°¿ÚÖÐÔËÐÐSQL*PlusµÄʱºò,¿ÉÒÔʹÓÃÏòÉÏ,ÏòϼüÀ´Ìø»Ø֮ǰÒѾִÐйýµÄSQLÓï¾ä.Äã¿ÉÒÔ¸ù¾ÝÐèÒªÐÞ¸ÄËûÃÇ,È»ºó°´Enter¼üÖØÐÂÌá½»Ö´ÐÐ.
È»¶ø,µ±ÔÚLinux ShellÖÐÔËÐÐSQL*PlusµÄʱºò,²¢²»Ìṩä¯ÀÀÀúÊ·ÃüÁîÐеŦÄÜ.
ΪÁËÔÚLinuxÖдﵽͬÑùµÄÄ¿µÄ,Ä ......
ORACLE 10 ѧϰ±Ê¼Ç-µÚ4¿Î-ÃüÁî¡£
1.commit;rollback;
2.select * from dictionary;
describe dba_users;
select * from dba_users;
select name from v$controlfile;
3.
alter database drop logfile group 3
select archiver from v$instance;
alter tablespace userdata read only;
4.
select tablespace_nam ......