AND & OR Operators

Other topics

AND OR Example

Have a table

NameAgeCity
Bob10Paris
Mat20Berlin
Mary24Prague
select Name from table where Age>10 AND City='Prague'

Gives

Name
Mary

select Name from table where Age=10 OR City='Prague'

Gives

Name
Bob
Mary

Syntax:

  1. SELECT * FROM table WHERE (condition1) AND (condition2);

  2. SELECT * FROM table WHERE (condition1) OR (condition2);

Contributors

Topic Id: 1386

Example Ids: 4517

This site is not affiliated with any of the contributors.