Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SQLÓï¾äPART2

Subquery: (single-row subqueries and multi-rows subqueries).
select select_list
from table
where expr operator (select select_list from table);
single-row subqueries operator: =, >, >=, <, <=, <>
e.g.:
1. select department_id, min(salary) from employees group by department_id having min(salary)>(select mn(salary) from employees where department_id = 50)
* min salary in department_id=50
* list department_id, min(salary) group by department_id and min(salary)> (min salary in departmentid=50).
2. select department_id, min(salary) from employees group by department_id having min(salary)>(select min(salary) from employees group by department_id);
* this sentense is wrong. has the subquery operates multi results.
Multi-row subqueires: any, all, in
IN:     equals to any member in the list
any:   1) must be preceded by =, !=, >, <, <=, >=. 2) compares a value to each value in a list or returned by a query. 3) evaluates to FALSE if the query returns no rows.
all:    1) must be preceded by =, !=, >, <, <=, >=. 2) compares a value to every value in a list or returned by a query. 3) evaluates to TRUE if the query returns no rows.
e.g.:
ndocsortid: 1...9
select ndocsortid from wf_docsort where nmoduleinfoid=2: results: 4,5,9
select ndocsortid from wf_docsort where nmoduleinfoid=9: results: null;
1. select  distinct ndocsortid
from  wf_procname
where ndocsortid < all (select ndocsortid from wf_docsort where nmoduleinfoid=2)
order by ndocsortid
results: 1,2,3
2. select nmoduleinfoid, ndocsortid, nprocid
from  wf_procname
where ndocsortid < any (select ndocsortid from wf_docsort where nmoduleinfoid=2)
order by ndocsortid 
results: 1,2,3,4,5,6,7,8
3. select  distinct ndocsortid
from  wf_procname
where ndocsortid < all (select ndocsortid from wf_docsort where nmoduleinfoid=9)
order by ndocsortid
results: 1,2,3,4,5,6,7,8,9
4. select&


Ïà¹ØÎĵµ£º

ÈçºÎжÔØSQL Server 2005

жÔØSQL Server 2005µÄ·½·¨Ö®Ò»£¬·ÅÔÚÕâ¶ùÖ»ÊÇΪÁ˼Çס£º
1£º°ÑSQL Server2005µÄ°²×°ÅÌ£¨°²×°Îļþ£©·ÅÈëµ½¹âÇý¡£
2£º´ò¿ªÈçÏ·¾¶£º¿ªÊ¼/ÔËÐУ¬ÊäÈ룺cmd
3£ºÊäÈëÏÂÁÐÃüÁ
 
Start /wait \setup.exe /qb REMOVE=ALL INSTANCENAME=£º¹ÜÇøÅÌ·û£¬ÀýÈ磺G£º¡¢H£ºµÈ£»£º°²×°µÄSQLServerʵÀýÃû³Æ£¬Ä¬ÈÏֵΪ£º¹¦ÄÜ ......

PL/SQL³ÌÐòÉè¼Æ£¨ÓαêµÄʹÓã©


 ÎªÁË´¦Àí SQL Óï¾ä£¬ORACLE ±ØÐë·ÖÅäһƬ½ÐÉÏÏÂÎÄ( context area )µÄÇøÓòÀ´´¦ÀíËù±ØÐèµÄÐÅÏ¢£¬ÆäÖаüÀ¨Òª´¦ÀíµÄÐеÄÊýÄ¿£¬Ò»¸öÖ¸ÏòÓï¾ä±»·ÖÎöÒÔºóµÄ±íʾÐÎʽµÄÖ¸ÕëÒÔ¼°²éѯµÄ»î¶¯¼¯(active set)¡£
 ÓαêÊÇÒ»¸öÖ¸ÏòÉÏÏÂÎĵľä±ú( handle)»òÖ¸Õ롣ͨ¹ýÓα꣬PL/SQL¿ÉÒÔ¿ØÖÆÉÏÏÂÎÄÇøºÍ´¦ÀíÓï¾äʱÉÏÏÂÎÄÇø»á·¢ÉúÐ ......

SQLÓï¾äÓï·¨

SQLÓï¾äÓï·¨
Ŀ¼
13.1. Êý¾Ý¶¨ÒåÓï¾ä
13.1.1. ALTER DATABASEÓï·¨
13.1.2. ALTER TABLEÓï·¨
13.1.3. CREATE DATABASEÓï·¨
13.1.4. CREATE INDEXÓï·¨
13.1.5. CREATE TABLEÓï·¨
13.1.6. DROP DATABASEÓï·¨
13.1.7. DROP INDEXÓï·¨
13.1.8. DROP TABLEÓï·¨
13.1.9. RENAME TABLEÓï·¨
13.2. Êý¾Ý²Ù×÷Óï¾ ......

[ת]SQLÐÐÁл¥»»

ÎÊÌ⣺¼ÙÉèÓÐÕÅѧÉú³É¼¨±í(tb)ÈçÏÂ:
ÐÕÃû ¿Î³Ì ·ÖÊý
ÕÅÈý ÓïÎÄ 74
ÕÅÈý Êýѧ 83
ÕÅÈý ÎïÀí 93
ÀîËÄ ÓïÎÄ 74
ÀîËÄ Êýѧ 84
ÀîËÄ ÎïÀí 94
Ïë±ä³É(µÃµ½ÈçϽá¹û)£º 
ÐÕÃû ÓïÎÄ Êýѧ ÎïÀí 
---- ---- --- ......

¹ØÓÚSQLSERVERÖиüÐÂTextÀàÐÍSQLÓï¾ä½âÎö

 »ù±¾·½·¨:
                   
UPDATETEXT { table_name.dest_column_name dest_text_ptr }//{ Òª¸üеıíÒÔ¼° text¡¢ntext »ò image ÁеÄÃû³Æ,Ö¸ÏòÒª¸üÐ嵀 text¡¢ntext »ò image Êý¾ÝµÄÎı¾Ö¸ÕëµÄÖµ£¨ÓÉ TEXT ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ