Changes

Jump to: navigation, search

Retrieving Data From a MySQL Database

694 bytes added, 18:43, 9 October 2007
Retrieving a Single Column
4 rows in set (0.00 sec)
</pre>
 
== Using SELECT to Retrieve Mutiple Columns ==
 
So far we have seen how easy it is to extract a single column from each row of a table. In the real world, it is more likely that information from more than one column will need to be retrieved. Fortunately the ''SELECT'' statement makes this task easy too. In fact, all that needs to be done is to specify the columns names after the SELECT statement, each separated by a comma. For example, to retrieve data from three columns in our database table:
 
<pre>
SELECT prod_code, prod_name, prod_desc FROM product;
</pre>
 
The above command will generate the following output if executed from within the [[The mysql Command-Line Tool|mysql]] tool:

Navigation menu