SQL – Query Table with Row Criteria using AND and OR

Select * From tablename

-- Select 3 columns
Select longitude,latitude,housing_median_age
From tablename

-- A condition for values in one column
Select longitude,latitude,housing_median_age
From tablename
Where housing_median_age = '30.000000'

-- A condition for values in more than one column. The AND operator.
Select longitude,latitude,housing_median_age
From tablename
Where housing_median_age = '30.000000'
And latitude >= '38.000000'

-- More than one condition in more than one column
-- Use one set of conditions or another. The OR operator.
Select longitude,latitude,housing_median_age
From tablename
Where housing_median_age = '30.000000'
And latitude >= '38.000000'
Or
housing_median_age = '40.000000'
And latitude >= '38.000000'