什么类型的查询适合根据特定用户输入返回结果?

什么类型的查询适合根据特定用户输入返回结果?

问题描述:

好的,例如用户在 Strawberry 中输入一个简单的 sql 查询就足够了.但是,如果用户输入 Strawberries,什么是合适的查询以返回基于 Strawberries 和 Strawberry 的结果,反之亦然.

Ok so for example is a user typed in Strawberry a simple sql query would be suffice. However if a user typed in Strawberries what would be a suitable query to return results based on Strawberries and Strawberry and vice versa.

Muhammad Sohail Arif 的回答没有错,但我个人觉得这更有用:

Muhammad Sohail Arif's answer is not wrong, but personally I find this more useful:

SELECT * FROM table WHERE column LIKE 'Strawberr%'

如果这对您来说还不够好,那么您有以下选择:

If that's not good enough for you, then you have the following options:

  1. 首先限制允许用户输入的输入.

  1. Restrict the input that users are allowed to enter in the first place.

对用户输入进行语言分析.(从获得博士学位研究资助开始.)

Implement linguistic analysis on the user input. (Begin by securing a Ph.D. research grant.)