Databases| SQL| MySQL| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Mysql Where Statement 
 

Mysql Where Statement is useful when we want to return the records on the basis of specified condition in Where Clause.

 

Mysql Where Statement

                         

Mysql Where Statement is useful when we want to return the records on the basis of specified condition in Where Clause. The Where Clause restricts the records and select only those records specified in it.

Understand with Example

The Tutorial illustrate an example from 'Mysql Where Statement'. To understand and grasp this example we create a table 'employee' whose fieldnames and datatypes are specified. 

Create table "employee" :

CREATE TABLE `employee` ( 
`username` varchar(200) default NULL, 
`emp_name` varchar(200) default NULL 

Describe the table "employee":

The Describe table is used to describe the fieldnames, datatypes, Null,  Key, Default etc of the table employee.

mysql> describe employee;
+----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| username | varchar(200) | YES | | | |
| emp_name | varchar(200) | YES | | | |
+----------+--------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

Query to insert the record in table "employee":

The Query insert into is used to add the records or rows to the table 'employee'.

insert into employee (username,emp_name) values('vin','Vineet Bansal')
insert into employee (username,emp_name) values('srbh','Saurabh');;

Query to display the record of table "employee":

The Query select helps you to return the records from table 'employee'.

mysql> select * from employee;
+----------+---------------+
| username | emp_name |
+----------+---------------+
| srbh | Saurabh |
| vin | Vineet Bansal |
+----------+---------------+
2 rows in set (0.00 sec)

Query to display the record of table "employee"  using  "where"  statement:

The Query  Where Clause returns only those records from table specified in Where Clause. In this example the table returns only those records   whose username is 'srbh' as specified in Where Clause.

mysql> select * from employee where username='srbh';
+----------+----------+
| username | emp_name |
+----------+----------+
| srbh | Saurabh |
+----------+----------+
1 row in set (0.02 sec)

                         

» View all related tutorials
Related Tags: sql c asp function input fun io variable tutorial parameter return ria create ie example unc to ram exam e

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.