FILTERING DATA Flashcards
WHERE
Keyword for condition used for filtering.
SELECT column
FROM data
WHERE column = 1;
=
Used when 2 values are equal or to pick a specific value
SELECT column
FROM data
WHERE column = 1;
‘ ‘
Quotes are used when writhing a text value
SELECT colour
FROM data
WHERE colour = ‘black’;
<>
Selects data that doesn’t satisfy a condition or not equal to
SELECT colour
FROM data
WHERE colour <> ‘black’;
<
Less that operator
SELECT number
FROM data
WHERE number < 5;
>
Greater that operator
SELECT number
FROM data
WHERE number > 5;
<=
Less that or equal to
SELECT number
FROM data
WHERE number <= 5;
>=
Greater that or equal to
SELECT number
FROM data
WHERE number >= 5;
BETWEEN
Keyword to check property within range.
SELECT *
FROM movies
WHERE rating BETWEEN 9 AND 10;
AND
Keyword used to define a range.
SELECT *
FROM movies
WHERE rating BETWEEN 9 AND 10;
LIKE
Keyword to filter out by pattern within text values
SELECT*
FROM movies
WHERE action LIKE ‘a%’ ;
%
It helps you define what latter/words starts, end and words in between a sentence or letter. If left on it own it gives all the data in a selected column
SELECT*
FROM movies
WHERE action LIKE ’a%’;