1. Home
  2. Computing & Technology
  3. PHP / MySQL

MySQL Tutorial: Managing MySQL data

By Angela Bradley, About.com

3 of 4

SQL Select Statement - Searching Data

Although in our test database we only have two entries and everything is easy to find, as a database grows it is useful to be able to quickly search the information. From phpMyAdmin you can do this by selecting your database, and then clicking the search tab. Above is an example of how to search for all users under 12 years old.

In our example database this only returned one result, Peggy.

To do this same search from the query window or command line we would type in:

SELECT * FROM people WHERE age < 12

What this does is SELECT *(all columns) from the "people" table WHERE the "age" field is a number less than 12.

If we only wanted to see the names of people who are under 12 years old we could run this instead:

SELECT name FROM people WHERE age < 12

This may be more helpful if your database contains a lot of fields that are irrelevant to what you are currently searching for.

3 of 4

Index: MySQL Tutorial: Managing MySQL data

  1. Insert Into SQL - Add Data
  2. SQL Update Command - Update Data
  3. SQL Select Statement - Searching Data
  4. SQL Delete Statement - Removing Data

Explore PHP / MySQL

More from About.com

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. Learn MySQL
  5. MySQL Tutorial - SQL Select - SQL Select Statement

©2008 About.com, a part of The New York Times Company.

All rights reserved.