Resolved: Why does '2000%' not work?
Why does the code
SELECT *
FROM employees
WHERE hire_date > '2000%';
Not work?
Hi João!
Thanks for reaching out.
Please, use the following code:
SELECT *
FROM employees
WHERE year(hire_date) > 2000;
You need to use the YEAR()
function in order to extract the year from the hire_date column.
Another solution is:
SELECT
*
FROM
employees
WHERE
hire_date LIKE '20%';
This code will give a result set with all years starting with '20'
which means all years bigger or equal to 2000.
Hope this helps.
Best,
Tsvetelin
can we use something like
SELECT *
FROM employees
WHERE hire_date > '2000-__-__';
??
and of course, we can use
SELECT *
FROM employees
WHERE hire_date > '2000-12-31';
which is the last day in 2000
But this answer is not practical and unprofessional
SELECT
*
FROM
employees
WHERE
gender = 'F' AND hire_date >= '2000-01-01';