Now, let’s play with some dates and strings.
For filtering the date column, we require it to be within single quotes, e.g., ‘ 2020-12-31’. Here, we can use operators like <, <=, >, >=, etc.
SELECT first_name, last_name,phone,course_date
FROM students
WHERE course_date > '2020-12-31'

We will select rows equaling a singFle date using the "=" sign.
SELECT first_name, last_name,phone,course_date
FROM students
WHERE course_date = '2024-09-16'

Now we want to exclude a specific date, we cannot use the “!” sign instead of “<>”:
SELECT first_name, last_name,phone,course_date
FROM students
WHERE course_date <> '2024-09-16'

Selecting a range is completed by using “between”, “and” keywords.
SELECT first_name, last_name,phone,course_date
FROM students
WHERE course_date between '2023-01-01' and '2024-12-31'

For filtering strings, we use four main keywords.
- “=”: When you know exactly what you are looking for (only one condition)
- “in”: When you know exactly what you but you can search with multiple filtering conditions
- “like”: When you part of the string
- “ilike”: When you want to ignore case sensitivity
Searching for a known last_name
SELECT first_name, last_name,phone,course_date
FROM students
WHERE last_name = 'Suresh'

Keep in mind that it is case-sensitive.
SELECT first_name, last_name,phone,course_date
FROM students
WHERE last_name = 'suresh'









Join the conversation! Your thoughts help the community grow.