Home » SQL Basics » Retrieving Data » Using AND/OR

Using AND/OR

Using AND/OR

Syntax: SELECT “column_name1”, “column_name2″,….”column_nameZ” FROM “table_name”
WHERE “simple condition1” [AND|OR] “simple condition2″…..

Example: SELECT name, age FROM employee where age > 35 and age < 65 In the above example it only displays all employees whose age is greater than 35 and less than 65. SELECT name, age FROM employee where age > 35 or age < 65 In the above example it only displays all employees whose age is greater than 35 or less than 65.

Leave a Reply

Your email address will not be published. Required fields are marked *