一 Insert 語句
1.在數(shù)據(jù)中只插入默認(rèn)值:
insert into [DBTrain].[dbo].[log_info]
default values
2.在可以為null 的字段中,如果要設(shè)置null,可以按下[Ctrl+0],注意是零不是o,如果要恢復(fù)修改前的值按[Esc]
二 Update 語句
可以更新前幾條或某個(gè)百分比的數(shù)據(jù)
update top(3) [log_info]
set info1 = '1001'
![](/d/20211017/5e297f2e7222c33d5a181adb9a4474c7.gif)
update top(80) percent [log_info]
set info2 = '1002'
![](/d/20211017/c238c1f659a9c628d28d43a61168ec99.gif)
三 Delete 語句同樣可以使用top 關(guān)鍵字
四 Select 語句
1. With Ties
執(zhí)行下面sql:select top 5 * from test
order by id desc
結(jié)果見下圖:
![](/d/20211017/13924282dc5493648e2c57b48b4713f6.gif)
再執(zhí)行以下sql 看不同:
select top 5 with ties * from test
order by id desc
![](/d/20211017/47ab4cd84f0579af2ea6dd99486c7dcd.gif)
可以看出來當(dāng)前五條記錄還沒有把id = 2的數(shù)據(jù)顯示完整的時(shí)候,
使用with ties,就可以把id = 2 的記錄都顯示出來
待續(xù). $identity, $RowGuid,Write子句
您可能感興趣的文章:- sql server的一個(gè)有趣的bit位運(yùn)算分享
- 關(guān)于SQL Server中bit類型字段增刪查改的一些事