在SQL中创建查询

时间:2015-01-21 17:33:33

标签: mysql sql

通过一个select命令创建查询以查找以下关键字的确切结果的最佳方法是什么:

‘‘Question About Programming’’ 
‘‘Question Programming About’’ 
‘‘Programming About Question’’ 
‘‘Programming Question About’’ 
‘‘About Programming Question’’ 
‘‘About Question Programming’’

上述关键字由用户提供,因此可以在查询中的where条件中使用。

2 个答案:

答案 0 :(得分:0)

使用Like运算符

select * from 
yourtable
where col like '%about%'
and col like '%programming%'
and col like '%question%'

答案 1 :(得分:-2)

SELECT * 
FROM table_name 
WHERE column_name in ('Question About Programming', 
                      'Question Programming About', 
                      'Programming About Question', 
                      'Programming Question About', 
                      'About Programming Question', 
                      'About Question Programming')