472,354 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,354 software developers and data experts.

Need help on simple pattern matching searching

I have a table that stores a list of zip codes using a varchar column type,
and I need to perform some string prefix pattern matching search. Let's say
that I have the columns:
94000-1235
94001
94100

If I run a pattern matching search for the string "940", then I should get
the top two rows of data back. If I run a pattern matching search for the
string "94", then I should get all the three rows of data back.
How can I do that in MySQL? I dont' need to do full-text search for this
prefix pattern matching search, do I? Thanks.
Jul 20 '05 #1
1 2632

SELECT * FROM database WHERE col LIKE '940%'

"Henry" <hj***************@yahoo.com> wrote in message
news:eY*******************@newssvr21.news.prodigy. com...
:I have a table that stores a list of zip codes using a varchar column type,
: and I need to perform some string prefix pattern matching search. Let's
say
: that I have the columns:
: 94000-1235
: 94001
: 94100
:
: If I run a pattern matching search for the string "940", then I should get
: the top two rows of data back. If I run a pattern matching search for the
: string "94", then I should get all the three rows of data back.
: How can I do that in MySQL? I dont' need to do full-text search for this
: prefix pattern matching search, do I? Thanks.
:
:
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

176
by: Thomas Reichelt | last post by:
Moin, short question: is there any language combining the syntax, flexibility and great programming experience of Python with static typing? Is there a project to add static typing to Python? ...
4
by: Xah Lee | last post by:
20050207 text pattern matching # -*- coding: utf-8 -*- # Python # suppose you want to replace all strings of the form # <img src="some.gif" width="30" height="20"> # to # <img...
2
by: MrNobody | last post by:
I would like to make a quick little hex editor so I need to display hex string pairs like a grid- if anyone is familiar with hex editors you'll know what I mean. I could accomplish this by using a...
2
by: phaeton123 | last post by:
I was trying to use Xquery to try to do pattern matching over mixed structured and unstructured content. For example consider the following xml fragment: ..... <article id="777">...
2
by: Ole Nielsby | last post by:
First, bear with my xpost. This goes to comp.lang.c++ comp.lang.functional with follow-up to comp.lang.c++ - I want to discuss an aspect of using C++ to implement a functional language, and...
1
by: VanKha | last post by:
I write this program for pattern-matching,but it gives wrong result: #include<iostream> #include<conio.h> #include<string.h> using namespace std; main() { char text,pat;...
9
by: Chris | last post by:
Is anyone aware of any prior work done with searching or matching a pattern over nested Python lists? I have this problem where I have a list like: , 9, 9], 10] and I'd like to search for the...
3
by: KYAW KYAW OO | last post by:
DearAll, I am trying to develop a C++ library for pattern matching in different lightings and searching the free one and samples for that. I couldn't managed to find the right and working...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.