[SQL Server]ÑÓ³ÙÖ´ÐÐ
WAITFOR
Ö¸¶¨´¥·¢Óï¾ä¿é¡¢´æ´¢¹ý³Ì»òÊÂÎñÖ´ÐеÄʱ¼ä¡¢Ê±¼ä¼ä¸ô»òʼþ¡£
Óï·¨
WAITFOR { DELAY 'time' | TIME
'time' }
²ÎÊý
DELAY
ָʾ Microsoft® SQL Server™ Ò»Ö±µÈµ½Ö¸¶¨µÄʱ¼ä¹ýÈ¥£¬×¿É´ï 24 Сʱ¡£
'time'
ÒªµÈ´ýµÄʱ¼ä¡£¿ÉÒÔ°´ datetime Êý¾Ý¿É½ÓÊܵĸñʽָ¶¨
time£¬Ò²¿ÉÒÔÓþֲ¿±äÁ¿Ö¸¶¨´Ë²ÎÊý¡£²»ÄÜÖ¸¶¨ÈÕÆÚ¡£Òò´Ë£¬ÔÚ datetime ÖµÖв»ÔÊÐíÓÐÈÕÆÚ²¿·Ö¡£
TIME
ָʾ SQL Server µÈ´ýµ½Ö¸¶¨Ê±¼ä¡£
×¢ÊÍ
Ö´ÐÐ WAITFOR Óï¾äºó£¬ÔÚµ½´ïÖ¸¶¨µÄʱ¼ä֮ǰ»òÖ¸¶¨µÄʼþ³öÏÖ֮ǰ£¬½«ÎÞ·¨Ê¹ÓÃÓë SQL Server µÄÁ¬½Ó¡£
ÈôÒª²é¿´»î¶¯µÄ½ø³ÌºÍÕýÔڵȴýµÄ½ø³Ì£¬ÇëʹÓà sp_who¡£
Ïà¹ØÎĵµ£º
µÚʮһÌ⣺
Óбístudents(name,class,grade),ÇëÓñê×¼sqlÓï¾äÍê³É
name class grade
ÕÅÈý Êýѧ 81
ÀîËÄ ÓïÎÄ 70
ÍõÎå Êýѧ 90
ÕÅÈý ÓïÎÄ 60
ÀîËÄ Êýѧ 100
ÍõÎå ÓïÎÄ 90
ÍõÎå Ó¢Óï 81
ÒªÇó: ÓÃsqlÓï¾äÊä³ö¸÷ÃŹ¦¿Î¶¼´óÓÚ80·ÖµÄͬѧÐÕÃû?
create table students (
name varchar(25),
class varchar(25),
grad ......
4¡¢¶ÔÏóÒÀÀµÐÔ
CREATE OR REPLACE TYPE Obj1 AS OBJECT (
f1 NUMBER,
f2 VARCHAR2(10),
f3 DATE
);
/
CREATE OR REPLACE TYPE Obj2 AS OBJECT (
f1 DATE,
f2 CHAR(1)
);
/
CREATE OR REPLACE TYPE Obj3 AS OBJECT (
a Obj1,
b Obj2
);
/
OBJ3ÒÀÀµÓÚOBJ ......
Merge statement
function benefits: 1) provides the ability to conditionally update, insert or delete data into a database table. 2) performs an update if the row exists, and an insert if it is a new row. --> 1) avoids seperate updates, 2) increase performance and ease of use. 3) is useful in dat ......
oracle tips
ExistµÄÓ÷¨£º
select gw.ndocid from
(select ndocid from wf_doc_gw_shouwen union select ndocid from wf_doc_gw_fawen) gw
where
not exists (select null from wf_doc_gw_sn sn where sn.ndocid=gw.ndocid)
2¡£°ÑGW±íºÍSN±íÀïÏàͬµÄNDOCIDÏÔʾ³öÀ´
select gw.ndocid from
(se ......
(×¢:outerµÄÒâ˼¾ÍÊÇ"ûÓйØÁªÉϵÄÐÐ"¡£)
1.cross join È«ÍâÁ¬½Ó(µÑ¿¨¶û³Ë»ý)
SELECT A.*, B.* from A FULL OUTER JOIN B ON A.ID = B.ID
2.inner join ÄÚÁ¬½Ó(Ôڵѿ¨¶û³Ë»ýµÄ½á¹û¼¯ÖÐÈ¥µô²»·ûºÏÁ¬½ÓÌõ¼þµÄÐÐ)
SELECT A.* from A INNER JOIN B ON A.ID=B.ID
3.left outer join ×óÍâÁ¬½Ó(ÔÚinner joinµÄ½á¹ ......