---使用北風資料庫
Use Northwind
/*
In /Not In
*/
--列出北美地區客戶
Select *
from dbo.Customers
where Country='Canada' or Country='USA' or Country='Mexico'
--IN
Select *
from dbo.Customers
where Country in('Canada','USA','Mexico')
--列出非北美地區客戶
Select *
from dbo.Customers
where Country<>'Canada' and Country<>'USA' and Country<>'Mexico'
--Not IN
Select *
from dbo.Customers
where Country not in('Canada','USA','Mexico')
沒有留言:
張貼留言