The example usage of like condition in sql statement
This article mainly introduces "the example usage of like condition of sql sentence". In the daily operation, I believe that many people have doubts about the example usage of like condition of sql statement. The editor has consulted all kinds of materials and sorted out the simple and easy-to-use operation method. I hope it will be helpful to answer the doubt of "example usage of like condition of sql sentence". Next, please follow the editor to study!
Table A no name 1 lu,li,zhang 2 zhou,wei,liu 3 li,fang Table B no name sex 1 li 1 2 lu 0 3 zhou 0 4 zhang 1 how to implement
The copy code is as follows: select * from A where A.name like (select B.name from B where B.sex=1)
-sqlserver writing
The copy code is as follows:
Select distinct a.no from a.name from a where charindex (b.namerea.name) > 0 and b.sex=1
Oracle writing method
The copy code is as follows:
Select distinct a.nomemory a.name from a where instr (a.nameme b.name) > 0 and b.sex=1-instr () locator substring instr ('Hello World',' or') returns 8
At this point, the study of "instance usage of like conditions in sql statements" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!