MySQL OR Operator
SYNTAX
SELECT DISTINCT
columns
FROM
table_name
WHERE
column OR column
Table structure Used for Example explanation
+—————-+————+
| Field | Type |
+—————-+————+
| Code | char(3) |
| Name | char(52) |
| Continent | char(40) |
| Region | char(26) |
| SurfaceArea | float(10,2)|
| IndepYear | smallint(6)|
| Population | int(11) |
| LifeExpectancy | float(3,1) |
| GNP | float(10,2)|
| GNPOld | float(10,2)|
| LocalName | char(45) |
| GovernmentForm | char(45) |
| HeadOfState | char(60) |
| Capital | int(11) |
| Code2 | char(2) |
+—————-+————+
Example for MySQL OR Operator
SELECT Name, Population FROM Country WHERE Population > 100000000 OR (Continent = ‘Asia’ );
Output of Above Example
+———————-+————+
| Name | Population |
+———————-+————+
| Afghanistan | 22720000 |
| United Arab Emirates | 2441000 |
| Armenia | 3520000 |
| Azerbaijan | 7734000 |
| Bahrain | 617000 |
| Bangladesh | 129155000 |
| Bhutan | 2124000 |
| Brazil | 170115000 |
| Brunei | 328000 |
| Philippines | 75967000 |
| Georgia | 4968000 |
| Hong Kong | 6782000 |
| Indonesia | 212107000 |
| India | 1013662000 |
| Iraq | 23115000 |
| Iran | 67702000 |
| Israel | 6217000 |
| East Timor | 885000 |
| Japan | 126714000 |
| Yemen | 18112000 |
| Jordan | 5083000 |