mysql數據過濾

一、AND操做符:class

select 表的字段名 from 對應的表名 where 表的字段名 AND 表的字段名 運算符 值;select

例子:select prod_id,prod_price,prod_name from products where ven_id = 1003 AND prod_price <= 10;權限

二、OR操做符:di

select 表的字段名 from 對應的表名 where 表的字段名 運算符 值 OR 表的字段名 運算符 值;運算符

例子:select prod_name,prod_price from products where vend_id = 1002 OR vend_id = 1003;

三、計算次序(AND有優先權限)

select prod_name,prod_price from products where (vend_id = 1002 OR vend_id = 1003) AND prod_price >= 10;

四、IN操做符:

select prod_name,prod_price from products where vend_id IN (1002,1003) order by prod_name;

五、NOT操做符:

select prod_name,prod_price from products where vend_id NOT IN (1002,1003) order by prod_name;

相關文章
相關標籤/搜索