Skip to content

LIKE, IN and BETWEEN · ⁨LIKE、IN 与 BETWEEN⁩

English

Matching text patterns with LIKE

= only matches text exactly. To match a pattern, use LIKE with two wildcards:

  • % stands for any run of characters (including none)
  • _ stands for exactly one character

'S%' means "starts with S". '%a%' means "contains an a". '_o%' means "an o as the second letter".

中文

用 LIKE 匹配文本模式

= 只能精确匹配文本。要匹配一个模式,用 LIKE 配合两个通配符:

  • % 代表任意一串字符(也可以是零个)
  • _ 代表恰好一个字符
SELECT name FROM student WHERE name LIKE 'S%';

'S%' 表示“以 S 开头”。'%a%' 表示“包含一个 a”。'_o%' 表示“第二个字母是 o”。

Handout

Log in or create account · ⁨登录或创建账户⁩

IGCSE, A-Level · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩