Python Forum
How to use the LIKE clause in Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use the LIKE clause in Python
#4
As stated by ncd85430, it's the SQLite engine that interprets the query.
That being said:

like = % for wildcard, for to find 'beautifulsoup' and anything that ends with soup: [inline]where ... like '%soup';[/inline
to find anything that has soup in anywhere in word: where ... like '%soup%'
you can use as many wildcards as necessary, for example:

Output:
select * from county where CountyName like '%Hill%nty%'; CountyId|StateId|StateCd|CountyName|ClassFP 107|05|AR|Phillips County|H1 095|08|CO|Phillips County|H1 057|12|FL|Hillsborough County|H1 017|13|GA|Ben Hill County|H1 147|20|KS|Phillips County|H1 059|26|MI|Hillsdale County|H1 041|30|MT|Hill County|H1 071|30|MT|Phillips County|H1 001|32|NV|Churchill County|H1 011|33|NH|Hillsborough County|H1 071|41|OR|Yamhill County|H1 211|48|TX|Hemphill County|H1 217|48|TX|Hill County|H1
ibreeden likes this post
Reply


Messages In This Thread
How to use the LIKE clause in Python - by Columbo - Oct-08-2022, 04:15 PM
RE: How to use the LIKE clause in Python - by Yoriz - Oct-08-2022, 04:24 PM
RE: How to use the LIKE clause in Python - by Larz60+ - Oct-08-2022, 07:40 PM
RE: How to use the LIKE clause in Python - by Yoriz - Oct-09-2022, 08:37 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  SQL Query is not executing WHERE clause hammer 7 2,507 Nov-15-2021, 01:44 PM
Last Post: hammer
  How does this if clause work? Pedroski55 3 2,365 Jun-10-2021, 06:31 AM
Last Post: Gribouillis
  can i raise an exception in a try clause? Skaperen 14 5,972 Dec-19-2019, 12:29 AM
Last Post: Skaperen
  pass captured value from input() to where clause metro17 5 3,400 Sep-09-2019, 05:24 AM
Last Post: metro17
  finally clause Skaperen 6 4,024 Jun-02-2019, 09:02 PM
Last Post: snippsat
  if clause fails DeadCthulhuWaitsDreaming 10 4,935 Apr-07-2019, 09:19 PM
Last Post: DeadCthulhuWaitsDreaming
  how to code in Python "where" clause of SAS FelixS 2 2,888 Mar-26-2019, 04:59 PM
Last Post: FelixS
  break Statements and else Clause on Loops Phytonnewbie 2 2,876 Mar-02-2018, 09:50 AM
Last Post: buran
  My else clause doesn't work (general help) NMW 10 8,185 Jul-17-2017, 01:07 AM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020