MySQL Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Mysql Tutorial
Introduction
How to Install
Database
Datatypes
Tables
INSERT
SELECT
UPDATE
DELETE
Operators
Functions
Ask Your Doubts
Feedback
 





MySQL Where statement


Tutorials Mysql

Topic
How to use MySQL Where Clause in Select Query?


Explanation

MySQL Where Statement :

        We can select a particular row using the WHERE clause statement. We can also check any condition using WHERE clause or keyword. Where condition comes handy when we come across a big table having huge volume of data but we might want to see only small number of rows satisfying a condition.

Select Using Where in MySQL syntax is

SELECT what_to_select FROM tbl_name WHERE conditions_to_satisfy;

    Here the conditions_to_satisfy specifies one or more conditions that rows must satisfy to qualify for retrieval.

    Let's see an example query for retrieving a single student data using the MySQL WHERE clause.
mysql> select * from student where name = 'jack';
+--------+------+-------+-----------------+---------+
| studid | name | marks | address         | phone   |
+--------+------+-------+-----------------+---------+
|      4 | jack |    82 | victoria street | 2436821 |
+--------+------+-------+-----------------+---------+
1 row in set (0.00 sec)
    Here in the above example query we have retrieved a single student details. Suppose if we want to retrieve the student's details who have secured more than 90 marks, we can use the below query.

mysql> select * from student where marks > 90;
+--------+-------+-------+------------------+---------+
| studid | name  | marks | address          | phone   |
+--------+-------+-------+------------------+---------+
|      1 | steve |   100 | 5th cross street | 2456987 |
|      2 | david |    98 | welling street   |  547896 |
|      5 | anne  |   100 | downing street   | 2634821 |
|      8 | mille |    98 | victoria street  | 1236547 |
+--------+-------+-------+------------------+---------+
4 rows in set (0.05 sec)
    We have used the mysql where statement to select the particular data from table.




A Note

MySQL is the most popular open source Relational database Management system (RDBMS). Being a open source anyone can use and change the software for their needs. Hope you enjoy this tutorial. We welcome your Valuable feedbacks or suggestions on this MySQL tutorial. This is a copyright content.


Other Links

web hosting