Training, Open Source computer languages

PerlPythonMySQLTclRubyC & C++LuaJavaTomcatPHPhttpdLinux

Search our site for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
SELECT in MySQL - choosing the rows you want
The SELECT command in MySQL allows you to examine rows in a table (or more than one table if you like). Good news - but sometimes there's an awful lot of data and you just want rows chosen by particular criteria, or just the first (so many) rows.

The WHERE clause on your select allows you to write a number of conditions which can be linked with AND and OR keywords, and there's a great deal of choice in the conditions. Here are some examples:

WHERE name = "Graham"
Will look for the string Graham (exactly) and nothing else in the field called name. Note that this selection is case sensitive if name is specified as being a binary field, and case insensitive otherwise.

WHERE name IN ("Graham","Lisa","Leah")
Will look for any one of the strings Graham Lisa or Leah (exactly in each case; same rule about case as in the example above).

WHERE name LIKE "%Graham%"
Will return any row that contains the word Graham within the name field. This is similar to file name matching (also known as globbing) except that the % metacharacter means "anything" and the _ character (that's an underscore) means any one character ... in place of * and ? in file name matching.

WHERE name RLIKE "^[[:graph:]]+$"
Will return any row with a single name in the name field - this is a regular expression which provides a huge flexibility in matching. Regular Expressions are notable in that you can ask a lot in a very obtuse string of just a few characters!
(written 2005-11-22 08:27:40)

 
Associated topics are indexed under
S152 - SQL Primer as Used in MySQL
S157 - More MySQL Commands

Back to
.css - using PHP to make dynamic style sheets
Previous and next
or
Horse's mouth home
Forward to
10 years C# knowledge please

Some other Articles
What are DHCP and DNS?
Would you steal ... petrol? ... a training course?
We are about Open Source programming courses in the UK
10 years C# knowledge please
SELECT in MySQL - choosing the rows you want
.css - using PHP to make dynamic style sheets
Bowerhill, Melksham, 2006 Calendar
Good IT training cannot be cheap
Why is Tomcat called Tomcat?
I have a river to cross
1780 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

© WELL HOUSE CONSULTANTS LTD., 2008: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 0800 043 8225 or 01225 708225 • FAX: 0845 8382 405 or 01225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho