資料庫 :AdventureWorks sql2008 範例資料庫
一年前我去面試得時候 ,那時我還不知道between用法的時候 , 在sql裡面查詢某一個資料行的區間範圍時我們用
select * from HumanResources.Employee where BirthDate >='1972-05-15' And BirthDate <='1977-05-15' 所謂的區間值其實本身已經隱含排序的味道,比如說日期, 真實數字 所以才有區間的感覺 在between 的語法下: where 資料行1 between A and B PS:A必須要小於B
select * from HumanResources.Employee where BirthDate Between '1972-05-15' and '1977-05-15'
所以這樣是不是簡單多了呢
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言