SELECT * FROM your_table_name WHERE column1 LIKE '_value1%' AND column2 = number2
SELECT * FROM your_table_name WHERE column1 LIKE '_value1%' OR column2 = number2
可以是用括號來決定優先權。
SELECT * FROM your_table_name WHERE (column1 LIKE '_value1%' OR column2 = number2) AND column3 = number3
SELECT * FROM your_table_name WHERE column1 > number1 ORDER BY column1 DESC
SELECT * FROM your_table_name WHERE column1 > number1 ORDER BY column1 ASC
範圍值可以是文字、數值或時間。
SELECT * FROM your_table_name WHERE column1 BETWEEN number1 AND number2
列出一序列文字或數字清單,欄位值必須存在才符合條件。
SELECT * FROM your_table_name WHERE column1 IN (number1, number2)
可以搭配運算子取得相反的內容,如下:
SELECT * FROM your_table_name LIMIT number1
SELECT * FROM your_table_name LIMIT number1, number2
注意:這裡的「number1」為0的話,代表第一筆資料開始。