| Home | JSP | EJB | JDBC | Java Servlets | WAP | Free JSP Hosting | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML | ||||
|
||||
| Tutorial Categories: Ajax
| Articles
| JSP
| Bioinformatics
| Database
| Free
Books |
Hibernate
| J2EE
| J2ME
| Java
| JavaScript
| JDBC
| JMS
| Linux
| MS
Technology |
PHP
| RMI
| Web-Services
| Servlets
| Struts
| UML
|
MySQL Select StatementIn this lesson you will be learn how to use SELECT statement in MySQL and you can also learn how to use SELECT statement with WHERE clause. The SELECT statement is used to retrieve the records from the table. There are some keywords uses in SELECT statement that are described in the following table
The simple SELECT statement is used to retrieve the all records from table. By the following example you can retrieve the full list of Emp table.
If you want to retrieve only some fields from a table, then you have to provide a comma separated list of column names. By the following example you select Name, City and Age fields from the Emp table.
The WHERE clause is used to limit the number of records. The comparison operators are used with WHERE clause to limit the number of records. Comparison operator’s list are given below:
% Character - If you are working with Strings, then % character can be used as a wildcard. By the following example you can retrieve the all fields from Emp table where the Designation field contain the text, 'Manager'.
_ character - The underscore character can be used as a placeholder. By the following example you can selects the all records from the table Emp, where the Name starts with ‘R’ followed by four characters. For this we have to use four underscores.
BETWEEN Clause - The BETWEEN clause can be used with numbers, dates and text. The following example is used to retrieve all fields Emp table where the Salary is between 10000 AND 20000.
OR Clause - The OR clause is used to check the values against the range of values that have been specified. The following example retrieves the list of all records where the Designation is either Manager or Assistant in the Emp table.
IN Clause - The IN clause is used to check the values against to many values that have been specified in IN clause. The following example retrieves the list of all records where the Designation is either Manager or Assistant in the Emp table.
NOT IN Clause - You can use the NOT modifier with IN clause for checking the values,. Which are not within the list. The following example retrieves the list of all records where the Designation is not equal to Manager or Assistant in the Emp table.
The following list shows you a Aggregate Function that available in MySQL.
The HAVING Clause
The ORDER BY Clause
The LIMIT Clause
|
| Facing Programming Problem? | |||||||
| Add This Tutorial To: | |||||||
| |
|
|
|
|
|
|
|
![]() |
|
JDO Tutorials EAI Articles Struts Tutorials Java Tutorials Java Certification |
|
|
|
||||||||||||||||||||||||||||||
|
Home | JSP | EJB | JDBC | Java Servlets | WAP | Free JSP Hosting | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs |
||||||||||||||||||||||||||||||
Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.
Copyright © 2007. All rights reserved.
Current Comments
2 comments so far (post your own) View All Comments Latest 10 Comments:Hi all
Im trying to connect mysql with asp its can connect but whn i useing like cluse its geting error
im using mysql connector 3.51
Posted by vinoth on Tuesday, 02.12.08 @ 10:52am | #47981
I see no description of the DISTINCT keyword in the SELECT description. It can be found in the original MySQL manual but with too little detail for a beginner...
Posted by Leo on Saturday, 05.12.07 @ 01:05am | #15678