SQL WHERE

It select the data based on the condition given .

SQL WHERE Syntax

SELECT column_name(s) FROM table_name WHERE column_name operator value ;

MySQL Table – users

+—-+——+
| id | name |
+—-+——+
|  1 | PHP  |
|  2 | JS   |
|  3 | HTML |
|  4 | PHP  |
+—-+——+

Example

mysql> select * from users where name=’PHP’;
+—-+——+
| id | name |
+—-+——+
|  1 | PHP  |
|  4 | PHP  |
+—-+——+
2 rows in set (0.00 sec)

Share