SQL ÃæÊÔÌâÒ»
1.ÓÃÒ»ÌõSqlÓï¾ä²éѯ³öÿÃŹ¦¿Î¶¼´óÓÚ80·ÖµÄѧÉúÐÕÃû
Name
Class
Result
ÕÅÈý
ÓïÎÄ
56
ÕÅÈý
Êýѧ
88
ÀîËÄ
ÓïÎÄ
92
ÀîËÄ
Êýѧ
100
ÍõÎå
ÓïÎÄ
88
ÍõÎå
Êýѧ
99
ÍõÎå
Ó¢Óï
99
-------------------------------------------------------------------------------
´ð°¸£º
SELECT DISTINCT name
from exercise
WHERE name NOT IN (SELECT name from exercise WHERE result < 80))
2. ɸѡ³ö±í"A"ÖеÚ31µ½40¼Ç¼£¨±íÖÐIDΪÖ÷¼ü,×¢Ò⣺IDºÅÓпÉÄܲ»ÊÇÁ¬ÐøµÄ£©
------------------------------
´ð°¸£º
SELECT TOP 10 from (SELECT TOP 40 * from A ORDER BY id DESC)
Ïà¹ØÎĵµ£º
ÔÚsql Server ´Ó¿ª·¢»·¾³ÍùÉú²ú»·¾³²¿Êðʱ£¬ÒòΪ¿Í»§ÄÇÀïÓõÄÊÇÓ¢ÎÄ°æ±¾£¬ËùÒÔ´´½¨Êý¾Ý¿âÒÔºó£¬ÒªÉèÖÃÒ»ÏÂÊý¾Ý¿âÅÅÐò¹æÔò¡£
µ«ÊÇÔÚ´æ´¢¹ý³ÌÖУ¬ÓеijÌÐòԱʹÓÃÁËÁÙʱ±í£¬ÒòΪÁÙʱ±íÊÇ´æ´¢ÔÚϵͳÊý¾Ý¿âtempdbÖУ¬Èç¹ûϵͳÁÙʱÊý¾Ý¿âûÓнøÐÐÅÅÐò¹æÔòµÄÉèÖ㬳ÌÐò»¹Êdzö´í£¬½â¾ö°ì·¨¾ÍÊÇÉèÖÃÁÙʱÊý¾Ý¿âµÄÅÅÐò¹æÔò»òÕß´´½¨ÁÙÊ ......
×î½üÔÚ¸ãÐÔÄÜÓÅ»¯£¬ÓÉÓÚÏîÄ¿µÄÐèÒª£¬ÎÒÃDZØÐ뾡¿ÉÄܵļõÉÙÊý¾Ý¿âµÄµ÷Óã¬ÓÚÊÇÎÒÃÇ×öÁ˲»ÉÙµÄÓÅ»¯£¬±ÈÈçÔÏÈÐèÒª3¸öÊý¾Ý¿âµ÷Óõģ¬ÏÖÔÚÎÒÃÇ°ÑËüÕûºÏµ½Ò»¸ö´æ´¢¹ý³ÌÖУ¬ÕâÑùÖ»ÐèÒªÒ»¸ö·½·¨¼´¿É¡£
µ«ÕâÒ²²úÉúÁËÁíÍâÒ»¸öÎÊÌ⣬֮ǰÎÒÃÇÊÇʹÓÃMS SQL ProfilerÈ¥¸ú×ÙÊý¾Ý¿âµÄµ÷Óõģ¬ÓÉÓÚÕûºÏÁ˲»ÉÙ´æ´¢¹ý³Ì£¬±ÈÈçÔÏÈÐèÒªÈý¸ö´æ ......
AspNetPagerÊÇÒ»¸ö±È½ÏºÃµÄ·ÖÒ³¿Ø¼þ,¸Ã¿Ø¼þʹÓùý³Ì·Öҳʮ·Ö·½±ã,¹ý³ÌÈçÏÂ:
Create PROCEDURE [dbo].[pt_AspNetPager]
(
@tableName varchar(255), -- ±íÃû
@fieldName varchar(400)= '*', -- ×Ö¶ÎÃû
@strWhere varchar(255) = Null,
@fieldOrder varchar(100), --²»ÄÜΪ¿Õ
@startIndex int ......
Oracle
SQL
µÄÓÅ»¯¹æ
Ôò£º
¾¡Á¿ÉÙÓÃIN²Ù×÷·û£¬»ù±¾ÉÏËùÓеÄIN²Ù×÷·û¶¼¿ÉÒÔÓÃEXISTS´úÌæ
ÓÃINд³öÀ´µÄSQL
µÄÓŵãÊDZȽÏÈÝÒ×д¼°ÇåÎúÒ׶®£¬µ«ÊÇÓÃINµÄSQL
ÐÔÄÜ×ÜÊDZȽϵ͵ģ¬´ÓORACLE
Ö´
ÐеIJ½ÖèÀ´·ÖÎöÓÃINµÄSQL
Óë²»ÓÃINµÄSQL
ÓÐ
ÒÔÏÂÇø±ð£º
......
Tree±íÈçÏÂ:
NodeId ParentId NodeName
0 -1 &nb ......