SQL AND

It select the data if all the conditions given are true

SQL AND Syntax

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

MySQL Table – users

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

Example

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

Share