Why is it that the MySql "or" operator behaves like an "and" operator?
Example:
mysql>SELECT * FROM employee_tbl
->WHERE daily_typing_pages= 250 OR
->daily_typing_pages= 220 OR daily_typing_pages= 170;
+------+------+------------+--------------------+
| id | name | work_date | daily_typing_pages |
+------+------+------------+--------------------+
| 1 | John | 2007-01-24 | 250 |
| 2 | Ram | 2007-05-27 | 220 |
| 3 | Jack | 2007-05-06 | 170 |
| 4 | Jill | 2007-04-06 | 220 |
+------+------+------------+--------------------+
why does it select all 3 records. Shouldn't it return the first match and be done with it? My mind right now is telling me that the "and" operator is the one that should by nature return all 3 rows. This behavior is different than how programming languages like PHP work. Any references to official documentation would be helpful or links to how the OR
and the AND
work would help too.