logo
g Text Version
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Sports
Travel & Culture
TV & Movies

dailyclick
Bored? Games!
Nutrition
Postcards
Take a Quiz
Rate My Photo

new
Emerging Music
Home Improvement
Comedy Movies
Vision Issues
Jewelry Collecting
Feng Shui
Appalachia


dailyclick
All times in EST

Full Schedule
g
g ASP Site
Editor Wanted
BellaOnline's ASP Editor

g

Like Statement in SQL - Inexact Wildcard Matches

Guest Author - Lisa Shea

If you're writing a SQL statement, sometimes you want wildcarded matches. The LIKE command lets you get matches that are similar to a phrase you supply.

Normally, if you write a SQL statement, you're looking for an exact match. If you're looking for all books written by SMITH, you would write:

SELECT * from books where author_name = 'SMITH';

and only those rows would be returned. What, though, if you are doing a search and want everything CONTAINING that word? What, for example, if you have a person put the word HORSE into your search box and want to return every title in your library containing the word HORSE? In that case you would write

SELECT * from books where book_title LIKE '%HORSE%';

The % is the wildcard symbol in SQL. If you wanted everything that began with HORSE, you would say

SELECT * from books where book_title LIKE 'HORSE%';

but usually you want the % on both sides of the word, so that if the HORSE shows up ANYWHERE in the title, you get the results.

This site needs an editor - click to learn more!

RSS | Related Articles | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map


Add Like+Statement+in+SQL+%2D+Inexact+Wildcard+Matches to Twitter Add Like+Statement+in+SQL+%2D+Inexact+Wildcard+Matches to Facebook Add Like+Statement+in+SQL+%2D+Inexact+Wildcard+Matches to MySpace Add Like+Statement+in+SQL+%2D+Inexact+Wildcard+Matches to Del.icio.us Digg Like+Statement+in+SQL+%2D+Inexact+Wildcard+Matches Add Like+Statement+in+SQL+%2D+Inexact+Wildcard+Matches to Yahoo My Web Add Like+Statement+in+SQL+%2D+Inexact+Wildcard+Matches to Google Bookmarks Add Like+Statement+in+SQL+%2D+Inexact+Wildcard+Matches to Stumbleupon Add Like+Statement+in+SQL+%2D+Inexact+Wildcard+Matches to Reddit



For FREE email updates, subscribe to the ASP Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor


Content copyright © 2012 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.

g


g features
Best uses for RSS

RSS and its future.

Force Download Dialog box with ASP

Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Fav Social Network
Facebook
Twitter
Google+
other / none



BellaOnline on Facebook
g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2012 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor