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

SQL ÕÒ³ö¶à¸ö×Ö¶ÎÂú×ãÆäÖÐÒ»¸ö×ֶεÄÐÂд·¨

ÕÒ³öTABLE1ÖÐ
Column1 Âú×ãvalue1
»òÕß
Column2 Âú×ãvalue2
»òÕß
Column3 Âú×ãvalue3
µÄ¼Í¼
SELECT top 10 * from TABLE1
WHERE
CASE WHEN COLUMN1='value1' THEN 1
ELSE
(CASE WHEN COLUMN2='value2' THEN 1
ELSE
(CASE WHEN COLUMN3=value3 THEN 1 ELSE 0 END)
END)
END =1


Ïà¹ØÎĵµ£º

SQL²åÈëÓï¾ä£¨INSERT INTO £©

INSERT INTO
 tableName ( columnName1, columnName2, columnName3, columnName4)
VALUES      (  '45', 'Î÷²Ø°ì',  TO_Date( '2010-03-10 12:00:00', 'YYYY-MM-DD HH24:MI:SS'), NULL,);
commit; ......

SQLµÄ×óÁ¬½Ó£¨left join £©


SELECT g.rid, room_no, planed_count,cc from
    (SELECT rid,room_no, planed_count from YC_HOTEL_ROOM_T ) r
left join
    (SELECT rid,count(*) cc  from  YC_GUEST_INFO_T group by rid ) g
ON   r.rid = g.rid  WHERE planed_ ......

oracle sql tuning

alert index mem_ct monitoring usage;
desc v$object_usage;
set linesize 190
select * from v$object_usage;
SQL>SET AUTOTRACE ON;
¡¡¡¡*autotrace¹¦ÄÜÖ»ÄÜÔÚSQL*PLUSÀïʹÓÃ
¡¡¡¡ÆäËûһЩʹÓ÷½·¨£º
¡¡¡¡2.2.1¡¢ÔÚSQLPLUSÖеõ½Óï¾ä×ܵÄÖ´ÐÐʱ¼ä
¡¡¡¡SQL> set timing on;
2.2.2¡¢Ö»ÏÔʾִÐмƻ®--(»áÍ¬Ê ......

SQL ServerÈÕÆÚ²Ù×÷

1¡¢²éѯÁ½¸öʱ¼äÖ®¼ä
select * from [tablename] where date between \'value1\' and \'value2\'
 
2¡¢ÏÔʾ×îºó»Ø¸´Ê±¼ä
select a.title,a.username,b.adddate from table a,(select max(adddate) adddate from table where table.title=a.title) b
 
3¡¢Èճ̰²ÅÅÌáÇ°5·ÖÖÓÌáÐÑ
select * from Èճ̰²ÅÅ w ......

SQLµÄ·ÖÒ³²éѯ

·ÖÒ³²éѯµÄÔ­Àí£º
 Õâ¸öÖ»ÄÜÓÃÔÙSql2005¼°ÒÔÉϵİ汾
DECLARE @pagenum AS INT, @pagesize AS INT  
SET @pagenum = 2   
SET @pagesize = 3   
SELECT *   
from (SELECT ROW_NUMBER()&n ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ