Last answered:

05 Nov 2022

Posted on:

20 Apr 2022

1

Why does '2000%' not work?

Why does the code

SELECT *
FROM employees
WHERE hire_date > '2000%';

Not work?

3 answers ( 0 marked as helpful)
Instructor
Posted on:

27 May 2022

7

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

Posted on:

29 Sept 2022

0

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

Posted on:

05 Nov 2022

0

SELECT
    *
FROM
    employees
WHERE
    gender = 'F' AND hire_date >= '2000-01-01';

Submit an answer