Simple Queries


An example of the simplest form of the SELECT statement is as follows :

 
 select * from department; 

If you run this query on the data we have in the employee database, you should get a result something like this:

 
 +---------------+--------------------------+  departmentID   name                      +---------------+--------------------------+             42  Finance                              128  Research and Development             129  Human Resources                      130  Marketing                 +---------------+--------------------------+ 4 rows in set (0.00 sec) 

This query has selected all the data in the chosen table ”that is, all the rows and all the columns from the department table.

You can test this out on another table ”try selecting all the rows and columns from the employeeSkills table, for example.

Of course, the power of a relational database is not in its capability to give you back all the data you put in, but instead in its capability to allow you to search the data for particular pieces of information.



MySQL Tutorial
MySQL Tutorial
ISBN: 0672325845
EAN: 2147483647
Year: 2003
Pages: 261

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net