以下是一些使用 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 语句中,百分号(%)用作通配符,表示任意数量的字符。下划线(_)用作单个字符的通配符。