SQL:1999Á¬½Ó
SQL:1999Á¬½Ó
SQL:1999Á¬½ÓÔÚÓï·¨ÉϺʹ«Í³µÄORACLEÁ¬½ÓÓÐןܴóµÄ²»Í¬¡£SQL:1999Á¬½ÓµÄÀàÐÍÔÚfromÓï¾äÖÐÖ¸Ã÷¡£ORACLE 9IÖ§³ÖµÄSQL:1999Á¬½Ó°üÀ¨£º
l CROSSÁ¬½Ó
l NATURALÁ¬½Ó
l OUTERÁ¬½Ó
l LEFT OUTERÁ¬½Ó
l RIGHT OUTERÁ¬½Ó
l FULL OUTERÁ¬½Ó
ÒÔϵļ¸¸öС½Ú½«Ïêϸ½éÉÜÕâЩеÄÁ¬½Ó·½Ê½¡£
2.3.1.1 CROSSÁ¬½Ó
CROSSÁ¬½ÓÊÇÒ»ÖÖ¶ÔÁ½¸ö±íµÄ½»²æ³Ë»ý¡£ÊǶÔÁ½¸ö±íµÄ¿¨µÑ¶û³Ë»ý¡£ÏÂÃæµÄÀý×Ó£º
SELECT last_name, department_name
from employees
CROSS JOIN departments;
Õâ¸öÓï¾äµÈͬÓÚ£º
SELECT last_name, department_name
from employees, departments;
2.2.1.2 NATURALÁ¬½Ó
NATURALÁ¬½ÓµÄÌõ¼þÊÇÁ½¸ö±íÖÐÃû³ÆÏàͬµÄ×ֶζ¼ÓÐÏàͬµÄÖµ¡£Èç¹ûÁ½¸ö±íÖÐÏàͬÃû³ÆµÄ×ֶεÄÀ಻ͬ£¬ÄÇô»á·¢Éú´íÎó¡£Èç¹ûÓÐselect *£¬ÄÇôÔÚ½á¹û¼¯ÖУ¬ÏàͬµÄ×Ö¶ÎÖ»³öÏÖÒ»´Î¡£
ÔÚNATURALÁ¬½ÓÖУ¬Ñ¡È¡µÄ×Ö¶ÎÇ°Ãæ²»ÐèÒªÓñðÃûÏÞ¶¨¡£±ÈÈ磺
SELECT employee_id, last_name, department_id
from employees
NATURAL JOIN departments;
µÈͬÓÚÏÂÃæµÄÓï¾ä£º
SELECT employee_id, last_name, departments.department_id
from employees, departments
WHERE employees.department_id = departments.department_id;
Èç¹û²¢²»ÊÇËùÓеÄÃû³ÆÏàͬµÄ×ֶζ¼ÐèÒª½øÐÐ’=’Á¬½Ó£¬ÄÇô¾Í²»ÄÜʹÓÃNATURALÁ¬½Ó£¬¶ø¿ÉÒÔʹÓÃUSINGÓï¾ä£¬±ÈÈç
SELECT employee_id, last_name, job_history.department_id
from employees
JOIN job_history
USING (employee_id);
Õâ¸öÓï¾äµÈͬÓÚ£º
SELECT employees.employee_id, last_name, job
Ïà¹ØÎĵµ£º
1. ²é¿´Êý¾Ý¿âµÄ°æ±¾
select @@version
³£¼ûµÄ¼¸ÖÖSQL SERVER´ò²¹¶¡ºóµÄ°æ±¾ºÅ:
8.00.194 Microsoft SQL Server 2000
8.00.384 Microsoft SQL Server 2000 SP1
8.00.532 Microsoft SQL Server 2000 SP2
8.00.760 &nb ......
[ORACLE]
ÏîÄ¿ÖÐÓöµ½Ò»¸öÐèÇó£¬ÐèÒª½«¶àÐкϲ¢ÎªÒ»ÐС£
±í½á¹¹ÈçÏ£º
NAME Null ......
create table "user" (
id int identity,
constraint PK_USER prim ......
×î½ü×öÁËÒ»ÍøÕ¾£¬µ«ÊÇÔÚÍâÃæ·ÃÎÊÌ«Âý¡£±¾ÏëÕÒÏÂÔÒò¡£¿´¿´ÊdzÌÐòÔÒò»¹ÊÇÊý¾Ý¿âÔÒò¡£ÔÚÍøÉϹä¹ä¡£¿´ÁËÒ»ÏÂÊý¾Ý¿âË÷Òý¡£ÏÖÔÚ×ܽáһϡ£·½±ãÏ´β鿴¡£±¾ÎıȽϻù´¡ÊÇÈëÃż¶±ðµÄ¡£
Ê×ÏÈ£¬Ê²Ã´ÊÇË÷Òý£¿´ÓBookOnlineÉÏsearchÁËһϣº
&nbs ......
ÎÒÃÇÒª×öµ½²»µ«»áдSQL,»¹Òª×öµ½Ð´³öÐÔÄÜÓÅÁ¼µÄSQL,ÒÔÏÂΪ±ÊÕßѧϰ¡¢ÕªÂ¼¡¢²¢»ã×ܲ¿·Ö×ÊÁÏÓë´ó¼Ò·ÖÏí£¡
£¨1£© Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
ORACLE µÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom× ......