php - MySql Or statement functionally not making sense -


why mysql "or" operator behaves "and" operator?

example:

mysql>select * 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 select 3 records. shouldn't return first match , done it? mind right telling me "and" operator 1 should nature return 3 rows. behavior different how programming languages php work. references official documentation helpful or links how or , and work too.

no, read query out loud this.

i want employee table if daily typing pages 250, or if daily typing pages 220, or if daily typing pages 170.

if told me drinks 7-11 either orange, blue, or green. i'd bring drinks.

if want limit, need explicitly state it:

select * employee_tbl      ->where daily_typing_pages= 250 or       ->daily_typing_pages= 220 or  daily_typing_pages= 170 limit 1;  

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -