考试报名
考试报名
考试内容
考试大纲
在线客服
返回顶部

备考刷题,请到

CDA认证小程序

Analyst A wants to query for products with names containing "new" in the data table. What is an appropriate way to perform fuzzy matching in the query?
A. like
B. <>
C. distinct
D. between
上一题
下一题
收藏
点赞
评论
题目解析
题目评论(0)

Fuzzy matching to find records containing the string value can be done using like '%string%'.

正确答案是:A: like

分析:
在SQL查询中,进行模糊匹配通常使用`LIKE`关键字。`LIKE`关键字允许使用通配符来匹配部分字符串,从而实现模糊搜索。具体来说,可以使用百分号`%`作为通配符来表示任意数量的字符。例如,要查询产品名称中包含“new”的所有记录,可以使用以下SQL语句:

```sql
SELECT * FROM products WHERE product_name LIKE '%new%';
```

在这个查询中,`%new%`表示产品名称中可以在任意位置包含“new”字符串。

其他选项的分析:
- B: `<>`:这个符号用于不等于操作,不适用于模糊匹配。
- C: `distinct`:这个关键字用于去除查询结果中的重复记录,不适用于模糊匹配。
- D: `between`:这个关键字用于范围查询,通常用于数字或日期范围查询,不适用于字符串的模糊匹配。

因此,使用`LIKE`关键字是进行模糊匹配的正确方法。