共計 684 個字符,預計需要花費 2 分鐘才能閱讀完成。
這篇文章主要為大家展示了“SQL 查詢語句怎么寫”,內容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓丸趣 TV 小編帶領大家一起研究并學習一下“SQL 查詢語句怎么寫”這篇文章吧。
查詢所有列
Select * from Tblclass
查詢指定列
Select cid,cname from tblclass
查詢指定列只顯示不同的項
Select distinct pwd trom Tblclass
查詢指定行
Select * from tblclass where cid = 4
查詢數據內容為空 / 非空的語句
Select * from tblclass where pwd is not null
Select * from tblclass where pwd is null
查詢列中的指定數據
Select * from tblclass where pwd in(123456)
cid int identity(1,2) primary key notnull
注: identity(1,2)
第一個參數為起始值為 1
第二個參數為步數 2
注:primary key
設置為主鍵,不接受相同參數,強行插入此值時需要用
Set identity_insert Tblclass on 打開語句后才能寫插入語句
Set identity_insert Tblclass off 關閉語句
修改 identity 參數
Dbcc checkident(tblclass ,reseed,200)
注:再增加數據時會從 200 開始起步
以上是“SQL 查詢語句怎么寫”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注丸趣 TV 行業資訊頻道!