如何在SQL中使用'like'运算符?

Jac*_*ack 2 sql sql-like

我想从C_Table哪里选择Name='John'并使用like运算符.例如,

select Name from C_Table where Name='John' AND where Details like %Boy%
Run Code Online (Sandbox Code Playgroud)

我该怎么做呢?

(Table name is C_Table)
-----------------------------------------------
Name   |  P_No  |  C_No   |  Details          |
-----------------------------------------------
John   |  001   |  001    |  Good Boy         |
John   |  002   |  002    |  Naughty Boy      |
John   |  003   |  003    |  Very Bad Boy     |
Mary   |  004   |  004    |  Beautiful Girl   |
Mary   |  005   |  005    |  Pretty Girl      |
Mary   |  006   |  005    |  Gorgeous         |
-----------------------------------------------
Run Code Online (Sandbox Code Playgroud)

wal*_*lyk 6

你几乎拥有它:

select name from table where name="John" and details like '%Boy%';
Run Code Online (Sandbox Code Playgroud)