³£ÓÃsqlÓï¾ä
1.ÏÞÖÆ·µ»Ø¼Ç¼µÄÐÐÊý£¨4-10ÐУ©
select rownum,c1 from t144 where rownum<10
minus
select rownum,c1 from t144 where rownum<5
2.ÅúÁ¿²åÈë
insert into tablename(select * from othertable)
»ò
insert into (column1,column2,,,,,,,)tablename(select column1,column2,,,,,,,from othertable)
3,·Ö×麯Êý(½á¹ûÖгöÏÖµÄÁÐÒªÔÚgroup by ÖгöÏÖ)
select count(age), username, , ,... from table group by age,usename,,,,...
4.²é¿´Êý¾Ý¿âÖеĴæÔڵıí
select table_name from dba_tables (include all users)
select * from tab(include view)
5.¸ßЧupdate£¬Ò»´ÎÐ޸Ķà¸öÁÐ
update smsmonitor sms
set (sms.smsmonitor_sendflag, sms.smsmonitor_maxnum) = (select s.smsmonitor_sendflag,
s.smsmonitor_maxnum
from smsmonitor s
where s.smsmonitor_id =
&nbs
Ïà¹ØÎĵµ£º
¡¡¡¡±¾ÎÄʾÀýÔ´´úÂë»òËØ²ÄÏÂÔØ
¡¡¡¡±¾½ÚµÄÄÚÈÝ£º
¡¡¡¡ÈçºÎÔÚInfoPathÖÐʹÓÃÊý¾ÝÁ¬½ÓÀ´´ÓSQL ServerÊý¾Ý¿âÖлñÈ¡Êý¾Ý
¡¡¡¡ÈçºÎͨ¹ý´úÂëÀ´ÐÞ¸ÄÊý¾ÝÁ¬½ÓÖеÄSQL²éѯ
¡¡¡¡ÔÚ¿ªÊ¼Éè¼ÆInfoPath±íµ¥Ö®Ç°£¬ÏÈ×¼±¸Ò»¸öÊý¾Ý¿â£¬InfoPathÖ§³ÖÁ½ÖÖÊý¾Ý¿âÁ¬½Ó£º
¡¡¡¡Microsoft Office AccessÊý¾Ý¿â£¨.mdbÎļþ»ò.accdbÎļþ£©
¡¡¡ ......
--Èç¹û´æÔÚÊý¾Ý¿âprogrammerPay ¾Íɾ³ý
if exists (select * from sysdatabases where name='programmerPay')
drop database programmerPay
go
--´´½¨Êý¾Ý¿âprogrammerPay
create database programmerPay
on primary
(
name ='programmerPay_data',
filename='D:\programmerPay\programmerPay_data.mdf',
......
bit£º0»ò1µÄÕûÐÍÊý×Ö
int£º´Ó-2^31(-2,147,483,648)µ½2^31(2,147,483,647)µÄÕûÐÍÊý×Ö
smallint£º´Ó-2^15(-32,768)µ½2^15(32,767)µÄÕûÐÍÊý×Ö
tinyint£º´Ó0µ½255µÄÕûÐÍÊý×Ö
decimal£º´Ó-10^38µ½10^38-1µÄ¶¨¾«¶ÈÓëÓÐЧλÊýµÄÊý×Ö
numeric£ºdecimalµÄͬÒå´Ê
money£º´Ó-2^63(-922,337,203,685,477.5808)µ½2^ ......
ÒÔǰ¶ÔÓÚSql ServerÖÐCaseÃüÁîµÄÓ÷¨Ò»Ö±²»ÊǺÜÁ˽⣬½ñÌìͨ¹ýÉÏÍø²éÁËһЩ×ÊÁÏ£¬½«Case»ù±¾µÄÓ÷¨×ܽáһϡ£
CaseÃüÁîÓÐÁ½ÖÖÓï·¨£º
A£©CASE<ÔËËãʽ>
WHEN <ÔËËãʽ> THEN <ÔËËãʽ>
……
WHEN <ÔËËãʽ> THEN <ÔËËãʽ>
[ELSE<ÔËËãʽ> ......