ÉèΪÊ×Ò³ ¼ÓÈëÊÕ²Ø

TOP

oracleÃæÊÔÌâ¼°Æä´ð°¸(Áù)
2014-11-24 02:23:02 ¡¾´ó ÖРС¡¿ ä¯ÀÀ:2700´Î
Tags£ºoracle ÊÔÌâ ¼°Æä ´ð°¸
t values (3 )
insert into test values (4 )
insert into test values (5 )
insert into test values (6 )
insert into test values (8 )
insert into test values (9 )
insert into test values (11)
insert into test values (12)
insert into test values (13)
insert into test values (14)
insert into test values (18)
insert into test values (19)
go
Now I want to list the result of the non-contignous row as below,how can I do it
Missing after Missing before
¡ª¡ª¡ª¡ª- ¡ª¡ª¡ª¡ª¨C
6 8
9 11
¡­
Answer 10£º
select id from test t where not exists(select 1 from test where id=t.id+1)
or not exists(select 1 from test where id=t.id-1)
29. Question11: How can I list all book with prices greather than the average price of books of the same type
In database pubs, have a table named titles , its column named price mean the price of the book, and another named type mean the type of books.
Now I want to get the result as below:
type title price
¡ª¡ª¡ª¡ª ¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¡ª¨C ¡ª¡ª¡ª¡ª¡ª¡ª¡ª
business The Busy Executive¡¯s Database Guide 19.9900
¡­
¡­
¡­
¡­
Answer 11£º
select a.type,a.title,a.price from titles a,
(select type,price=avg(price) from titles group by type)b
where a.type=b.type and a.price>b.price
ÊÔÌâµãÆÀ£ºÍ¨ÀÀÕû¸öÊÔÌ⣬ÎÒÃDz»ÄÑ·¢ÏÖ£¬Õâ·ÝÊÔÌâÊÇÕë¶ÔSQL ServerÊý¾Ý¿âÈËÔ±µÄ¡£¶ø´ÓÄѶȷÖÎöÉÏÀ´¿´£¬Õâ·ÝÊÔÌâÒ²ÊôÓÚͬÀàÊÔÌâÖбȽÏÄѵÄÁË¡£Ö®ËùÒÔ˵ËüÄÑ£¬Ê×ÏÈÊÇÏÞ¶¨Ê±¼äµÄÈ«Ó¢ÎÄÊÔÌ⣻Æä´Î£¬¾¡¹ÜÕâ·ÝÊÔÌâÖ÷ÒªÊÇ¿¼ºË¿ª·¢ÄÜÁ¦£¬µ«È´Éæ¼°µ½ÁËËã·¨µÄÑ¡ÔñºÍÐÔÄܵĵ÷ÓÅ£»×îºó£¬Õâ·ÝÊÔÌ⻹¼Ð½øÁËSQL ServerÊý¾Ý¿âµÄÉý¼¶ÎÊÌâ¡£Òò´Ë£¬×ÛÉÏËùÊö£¬ÎÒÃǹÀ¼ÆÕâÊÇÒ»¼Ò´ÓʳÌÐòÍâ°ü¹¤×÷µÄÍâÆóÕÐƸºǫ́¿ª·¢»òÓëºǫ́¿ª·¢Ïà¹ØµÄSQL Server¸ß¼¶³ÌÐòÔ±µÄÊÔÌâ¡£


Ê×Ò³ ÉÏÒ»Ò³ 3 4 5 6 7 8 9 ÏÂÒ»Ò³ βҳ 6/9/9
¡¾´ó ÖРС¡¿¡¾´òÓ¡¡¿ ¡¾·±Ìå¡¿¡¾Í¶¸å¡¿¡¾Êղء¿ ¡¾ÍƼö¡¿¡¾¾Ù±¨¡¿¡¾ÆÀÂÛ¡¿ ¡¾¹Ø±Õ¡¿ ¡¾·µ»Ø¶¥²¿¡¿
ÉÏһƪ£ºÈçºÎÅжÏÒ»¶Î³ÌÐòÊÇÓÉ C ±àÒë³ÌÐò.. ÏÂһƪ£ºÓÃÁ´±íÄ£Äâ´óÕûÊý¼Ó·¨ÔËËã

×îÐÂÎÄÕÂ

ÈÈÃÅÎÄÕÂ

Hot ÎÄÕÂ

Python

C ÓïÑÔ

C++»ù´¡

´óÊý¾Ý»ù´¡

linux±à³Ì»ù´¡

C/C++ÃæÊÔÌâÄ¿