以下是一些使用 SQL 的 LIKE 語句的示例代碼:
SELECT * FROM table_name WHERE name LIKE 'A%';
SELECT * FROM table_name WHERE name LIKE '%John%';
SELECT * FROM table_name WHERE name LIKE '__%';
SELECT * FROM table_name WHERE name LIKE 'A__';
SELECT * FROM table_name WHERE name LIKE '%John%';
SELECT * FROM table_name WHERE name LIKE 'A%Smith%';
SELECT * FROM table_name WHERE name LIKE 'A_%';
注意:在 LIKE 語句中,百分號(%)用作通配符,表示任意數量的字符。下劃線(_)用作單個字符的通配符。