Victoria Becu

Use AND, OR and comparison operators in WHERE

A few and and or operators manipulating data from the movies table.

  • December 17, 2016 at 3:13 PM
  • Visible to public
SELECT *
FROM countries
WHERE 
	country_name LIKE '%stan%' 
	OR continent == 'AFRICA'
	OR 
		(continent == 'AMERICA' 
		AND country_name != 'United States'
		AND country_name != 'Canada')

SELECT *
FROM movies
WHERE 
	(year_released >= 1990 AND year_released < 2000) 
	AND (country = 'us' OR country = 'uk')

SELECT *
FROM movies
WHERE 
	(title LIKE 'Le %' OR title LIKE 'The %') 
	moAND (country != 'gb' and country != 'au')

SELECT *
FROM movies
WHERE 
	(title LIKE '% 2' OR title LIKE '% 3') 
	AND (country != 'us' AND country != 'gb')