oracle sqlÃæÊÔÌâ2
Ò»£®¼òµ¥SQL²éѯ£º
1£©:ͳ¼Æÿ¸ö²¿ÃÅÔ±¹¤µÄÊýÄ¿
select dept,count(*) from employee group by dept;
2£©:ͳ¼Æÿ¸ö²¿ÃÅÔ±¹¤µÄÊýÄ¿´óÓÚÒ»¸öµÄ¼Ç¼
select dept,count(*) from employee group by dept having count(*)>1;
3£©:ͳ¼Æ¹¤×ʳ¬¹ý1200µÄÔ±¹¤ËùÔÚ²¿ÃŵÄÃû³Æ
select e.first_name,salary,d.name
from s_emp e, s_dept d
where e.dept_id = d.id
and salary > 1200;
4£©:²éѯÄĸö²¿ÃÅûÓÐÔ±¹¤
select e.empno, d.deptno
from emp e, dept d
where e.deptno(+) = d.deptno
and e.deptno is null;
or
select *
from dept d
where not exists(select 1 from emp e
where e.deptno = d.deptno
);
¶þ£®¸´ÔÓSQL²éѯ
ÓÐ3¸ö±í£¨15·ÖÖÓ£©£º(SQL)
Student ѧÉú±í (ѧºÅ£¬ÐÕÃû£¬ÐÔ±ð£¬ÄêÁ䣬×éÖ¯²¿ÃÅ)
Course ¿Î³Ì±í (±àºÅ£¬¿Î³ÌÃû³Æ)
Sc Ñ¡¿Î±í (ѧºÅ£¬¿Î³Ì±àºÅ£¬³É¼¨)
±í½á¹¹ÈçÏ£º
1) дһ¸öSQLÓï¾ä£¬²éѯѡÐÞÁË’JAVA’µÄѧÉúѧºÅºÍÐÕÃû£¨3·ÖÖÓ£©
´ð£ºSQLÓï¾äÈçÏ£º
select stu.sno, stu.sname
from student stu, course c, sc
where stu.sno = sc.sno
and sc.cno = c.cno
and c.cname=’JAVA’;
2) дһ¸öSQLÓï¾ä£¬²éѯ’a’ͬѧѡÐÞÁ˵ĿγÌÃû×Ö£¨3·ÖÖÓ£©
´ð£ºSQLÓï¾äÈçÏ£º
select stu.sname, c.cname
from student stu, course c, sc
where stu.sno = sc.sno
and sc.cno = c.cno
and stu.sname = ’a’;
3) дһ¸öSQLÓï¾ä£¬²éѯѡÐÞÁË5Ãſγ̵ÄѧÉúѧºÅºÍÐÕÃû£¨9·ÖÖÓ£©
´ð£ºSQLÓï¾äÈçÏ£º
select stu.sno, stu.sname
from student stu
where (select count(*) from sc where sno=stu.sno) = 5;
Èý. ÔÚSQLÖÐɾ³ýÖظ´¼Ç¼µÄ·½·¨:£¨Óõ½rowid (oracleαÁÐ)£©
1£©Í¨¹ý½¨Á¢ÁÙʱ±íÀ´ÊµÏÖ
SQL>create table temp_emp as (select distinct * from employee)
SQL>truncate table employee; (Çå¿Õemployee±íµÄÊý¾Ý£©
Ïà¹ØÎĵµ£º
MapViewer ÊÇÒ»¸ö J2EE ·þÎñ£¬ËüʹÓÃÓÉ Oracle Spatial ¹ÜÀíµÄ¿Õ¼äÊý¾ÝÀ´»æÖƵØͼ¡£MapViewer ÌṩµÄ·þÎñºÍ¹¤¾ßÒþ²ØÁË¿Õ¼äÊý¾Ý²éѯºÍµØͼ²â»æµÄ¸´ÔÓÐÔ£¬Í¬Ê±Îª½Ï¸ß¼¶µÄÓû§Ìṩ¿ÉÒÔ×Ô¶¨ÒåµÄÑ¡Ïî¡£MapViewer Ö¼ÔÚÓë»ùÓÚλÖõķþÎñºÍÓ¦ÓóÌÐòÏ༯³É¡£
µ¥»÷´Ë´¦»ñµÃ Oracle Ó¦Ó÷þÎñÆ÷ MapViewer µÄÆÁÄ»ÕÕƬ¡£
http://www.or ......
ÔÚJ2EEÓ¦ÓóÌÐò¿ª·¢ÖУ¬Ó¦ÓóÌÐòÓëÊý¾Ý¿âÁ¬½ÓµÄ½¨Á¢ÊÇÎÒÃǾ³£Óöµ½µÄÎÊÌâÖ®Ò»¡£ÔÚÕâÀïÎÒÖ÷Ҫ̸̸ÔÚ±¾µØÓ¦ÓóÌÐòÖÐͨ¹ýOCI·½Ê½¡¢thin·½Ê½ºÍJdbcOdbcÇÅ·½Ê½Á¬½ÓOracleÊý¾Ý¿â£¬ÔÚiPlanet Application Server 6.5ºÍSun Java System Application Server 7ÖжÔOracleÊý¾Ý¿âÁ¬½Ó³ØµÄÅäÖÃÒÔ¼°Ó¦ÓÃÖÐÈçºÎ´ÓÁ¬½Ó³ØÖлñµÃÁ¬½Ó
Ò»¡¢±¾µ ......
ÎÒÃÇÔÚƽ³£µÄϵͳ¿ª·¢Öг£³£»áÓöµ½ÏñÎÞÏÞ¼¶·ÖÀàÕâÑùµÄÊ÷ÐͽṹÊý¾Ý£¬ÏÖÌṩһ¸ö¿ÉÓõÄÊý¾Ý¿â´æ´¢¹ý³Ì£¬¿ÉÒÔÍê³ÉÊ÷ÐͽṹÊý¾ÝµÄÅÅÐò¡£
»·¾³£ºwindows7+Sql Server 2008
˵Ã÷£ºÏÂÃæ´úÂëÒѾת»»³ÉSql server2000µÄ½Å±¾£¬´¦ÀíЧ¹ûÈçÏ£¬¿´sortname×ֶνá¹û,´úÂë¾¹ý²âÊÔ¡£
´´½¨Ê÷Ðͱí
CREATE TABLE [dbo].[categories](
......
Õ⼸Ì츺ÔðÒ»¸ö¼Ò½ÌÃÅ»§ÍøÕ¾µÄ¿ª·¢£¬»ùÓÚcakephp¿ò¼Ü¡£ÔÚÅàѵ»ú¹¹±í£¨schools£©ÖдæÔÚÒ»¸ö×Ö¶ÎsubjectÓÃÀ´´æ´¢ÁíÒ»¸öÊý¾Ý±í
£¨subjects£©ÖмǼµÄidÖµ£¬ÇÒ´æ´¢ÐÎʽΪ£º'1,2,3,4,5'¡£µ«ÊÇÔÚÓ¦Óø߼¶ËÑË÷¹ýÂËʱҳÃæselectÑ¡ÏîoptionµÄ´«ÖµÎª
subjectsµÄidÖµ£¬ÐèÒªÅжϲéѯ±íschoolsÖÐsubject×ֶδæÔÚ´Ëid£¬¼´²éѯÏÔʾ´Ë¼Ç¼ ......