Changes

Jump to: navigation, search

Using WHERE to Filter MySQL Data

930 bytes added, 15:56, 12 October 2007
The Basics of the WHERE Clause
</pre>
This is fine if we actually want a list of every row in our table. It is more likely, however, that we really want a subset of the rdata in the table. For example, if we wanted to retrieve only the rows where the price matches a certain value we might construct a SQL statement as follows: <pre>SELECT * FROM products WHERE prod_price = 49;<pre> Such a statement would result in the following output when executed on our sample database: <pre>+-----------+--------------------------+-------------------+------------+| prod_code | prod_name | prod_desc | prod_price |+-----------+--------------------------+-------------------+------------+| 3 | Microsoft 10-20 Keyboard | Ergonmoc Keyboard | 49 || 4 | EasyTech Mouse 7632 | Cordless Mouse | 49 |+-----------+--------------------------+-------------------+------------+2 rows in set (0.00 sec)</pre> Now that we have looked at the equality operator (=) we can now explore the other ''WHERE'' clause operators. == Comparison Operators ==

Navigation menu