oracleº¯ÊýÏê½â
1¡¢SQL Óï¾ä»ù´¡
ÏÂÃæ¸ø³öSQLÓï¾äµÄ»ù±¾½éÉÜ¡£
1.1¡¢SQLÓï¾äËùÓ÷ûºÅ
²Ù×÷·û ÓÃ; Àý×Ó
+ - ±íʾÕýÊý»ò¸ºÊý£¬ÕýÊý¿ÉÊ¡È¥ + -1234.56
+ ½«Á½¸öÊý»ò±í´ïʽ½øÐÐÏà¼Ó A=c+b
- ½«Á½¸öÊý»ò±í´ïʽ½øÐÐÏà¼õ 34-12
* ½«Á½¸öÊý»ò±í´ïʽ½øÐÐÏà³Ë 12*34
/ ³ýÒÔÒ»¸öÊý»ò±í´ïʽ 18*11
NULL ¿ÕÖµÅÐ¶Ï Where name is null;
|| ×Ö·û´®Á¬½Ó ‘101-’||tel_num
= µÈÓÚ²âÊÔ Select * from emp where name=’ÕÔÔª½Ü’;
!= »ò<>»ò^= ²»µÈÓÚ²âÊÔ Select * from emp where name !=’ÕÔÔª½Ü’;
<
СÓÚ²âÊÔ Select * from emp where sal < 5000;
>
´óÓÚ²âÊÔ Select * from emp where sal > 5000;
<= СÓÚµÈÓÚ²âÊÔ Select * from emp where sal <= 5000;
>= ´óÓÚµÈÓÚ²âÊÔ Select * from emp where sal >= 5000;
Not in ²âÊÔijֵÊÇ·ñÔÚÒ»¸öÖ¸¶¨µÄ½á¹û¼¯ÖÐ Select name,addr from expert where local not in(‘±±¾©’,’ÉϺ£’);
ANY ½«Ò»¸öÖµÓëÒ»×éÖµ½øÐбȽϣ¬·µ»ØÂú×ãÌõ¼þµÄ½á¹û¡£±ØÐë¸ú!=,<,>,<=,>= select ename,sal from emp where sal<= any(select sal from emp where deptno=10)
SOME ͬANY£¬±ØÐë¸ú!=,<,>,<=,>=
ALL ½«Ò»¸öÖµÓëÒ»×éÖµ±È½Ï£¬·µ»ØÂú×ãÌõ¼þµÄËùÓÐÁÐÖµ¡£±ØÐë¸ú!=,<,>,<=,>= Select name,sal from emp w here sal<= all
( 500,800,1200);
Not between
A and B ÅжÏij¸öÖµÊÇ·ñ½çÓÚÁ½ÕßÖ®¼ä¡£ Select name,sal from emp Where
sal between 500 and 1200;
[not]exists ÅжÏij¸öÁÐÊÇ·ñ´æÔÚÓÚÒ»×éÖµÖС£ select dname,deptno from dept where exists
(select * from emp where dept.deptno=emp.deptno)
A[not]like b
±È½ÏÁ½¸öģʽÊÇ·ñÏàËÆ£¬µ±Ê¹ÓÃlike Óï¾äʱOracle²»È¥·ÃÎÊË÷Òý¡£ Select * from emp
Where ename like ‘TH%’;
Is [not] null ²âÊÔÖµÊÇ·ñΪ¿Õ¡£ Select ename,deptno from emp
Where comm. Is null or comm.=0;
Not ¶Ô½á¹ûµÄ·ñ¶¨¡£ Select * from emp Where sal not(sal<1000); µÈ¼ÛÓÚselect ename,sal from emp where sal>=1000;
AND ÓÃÓÚÅжÏÁ½¸öÌõ¼þÊ®·Ö¶¼Âú×ã¡£ Select * from emp where
Ename=’SIMTH’ and sal>=1000;
OR ÓÃÓÚÅжÏÁ½
Ïà¹ØÎĵµ£º
ËäȻѧϰJavaºÜ¾ÃÁË£¬×Ô¼ºÒ²Á¬½Ó¹ýһЩÊý¾Ý¿â£¬±ÈÈçmysqlÖ®ÀàµÄ£¬Èç½ñÄØ£¬Ò²Ñ§Ï°ÁËÒ»¶Îʱ¼äµÄOracle£¬È»¶øÄØ£¬½ñÌìÊÇÎÒµÚÒ»´ÎÁ¬½ÓOracle£¬ºÙºÙ£¬Ó¦¸Ã»¹²»ËãÌ«³Ù°É¡£
½ñÌìÄØ£¬Óе㱿׾£¬´ó¼ÒĪЦ£¡
ÎÒÕâÊÇÒ»¸ö²éѯÀý×Ó
Ê×ÏÈ£¬Ô ......
oracleµÄÌåϵ̫ÅÓ´óÁË£¬¶ÔÓÚ³õѧÕßÀ´Ëµ£¬ÄÑÃâ»áÓÐЩÎÞ´ÓÏÂÊֵĸоõ£¬Ê²Ã´¶¼Ïëѧ£¬½á¹ûʲô¶¼Ñ§²»ºÃ£¬ËùÒÔ°Ñѧϰ¾Ñé¹²Ïíһϣ¬Ï£ÍûÈøոÕÈëÃŵÄÈ˶ÔoracleÓÐÒ»¸ö×ÜÌåµÄÈÏʶ£¬ÉÙ×ßһЩÍä·¡£
Ò»¡¢¶¨Î»
oracle·ÖÁ½´ó¿é£¬Ò»¿éÊÇ¿ª·¢£¬Ò»¿éÊǹÜÀí¡£¿ª·¢Ö÷ÒªÊÇдд´æ´¢¹ý³Ì¡¢´¥·¢Æ÷ʲôµÄ£¬»¹ÓоÍÊÇÓÃOracle ......
1.ÊÂÎñ¸ÅÊö
ÊÂÎñ£¨Transaction£©ÊÇÊý¾Ý¿âÇø±ðÓÚÎļþϵͳµÄÌØÐÔÖ®Ò»¡£ÔÚÎļþϵͳÖУ¬Èç¹ûÄãÕý°ÑÎļþдµ½Ò»
°ë£¬²Ù×÷ϵͳͻȻ±ÀÀ£ÁË£¬Õâ¸öÎļþ¾ÍºÜ¿ÉÄܻᱻÆÆ»µ¡£²»´í£¬È·Êµ»¹ÓÐһЩ“ÈÕ±¨Ê½”£¨journaled£©Ö®
ÀàµÄÎļþϵͳ£¬ËüÃÇÄÜ°ÑÎļþ»Ö¸´µ½Ä³¸öʱ¼äµã¡£²»¹ý£¬Èç¹ûÐèÒª±£Ö¤Á½¸öÎļþͬ²½£¬ÕâЩÎļþϵͳ ......
oracle µÄÔ¼ÊøÖ÷ÒªÊÇÔÚÒµÎñÂß¼²ãÃæά»¤Êý¾ÝµÄÍêÕûÐÔ¡£Ö÷Ҫͨ¹ý³ÌÐòÔ±ÔÚÓ¦ÓóÌÐòÖй涨ԼÊø»òÕßͨ¹ý¶¨Òå´¥·¢Æ÷À´Î¬»¤Êý¾ÝÍêÕûÐÔ£¬×îºóÊÇͨ¹ýʹÓÃoracle×Ô´øµÄÔ¼ÊøÀ´Î¬»¤Êý¾ÝÍêÕûÐÔ¡£ÄÜʹÓÃoracle×Ô´øµÄÔ¼Êø´ïµ½ÒªÇó¾Í¾¡Á¿Ê¹ÓÃoracle×Ô´øµÄÔ¼Êø£¬ÒòΪʹÓô¥·¢Æ÷µÈÓû§×Ô¶¨ÒåÔ¼Êø¶¼»áÓ°ÏìÊý¾Ý¿âµÄÐÔÄÜ¡£ÀýÈ磺ʹÓô¥·¢ ......
select a.constraint_name, a.table_name, b.constraint_name
from user_constraints a, user_constraints b
where a.constraint_type = 'R'
and b.constraint_type = 'P'
and a.r_constraint_name = b.constraint_name
P ´ú±íÖ÷¼ü
R ´ú±íÍâ¼ü
ͨ¹ý¹ØÁª£¬Äܲéѯµ½ÄãËùÏëÒªµÄÒ»ÇС£
select co ......