Query Oracle SQL HR schema, how to get a query referring to dates?

1

1. I want to show the employees that were hired in the month of May.

select FIRST_NAME from EMPLOYEES where HIRE_DATE=?????

2.There is another query that employees ask me that do not have a commission but where I do COMMISSION_PCT = null or '' but it does not work for me if there is some simpler way to do it.

    
asked by JJsCR 21.05.2018 в 17:35
source

2 answers

1

For the May date:

SELECT FIRST_NAME
FROM EMPLOYEES
WHERE HIRE_DATE BETWEEN TO_DATE ('2018/05/01', 'yyyy/mm/dd')
AND TO_DATE ('2018/05/31', 'yyyy/mm/dd');

For the commission:

SELECT *
FROM EMPLOYEES
WHERE COMMISION_PCT IS NULL
    
answered by 21.05.2018 / 17:43
source
1

To get the month in oracle you can use an extract something like this:

select FIRST_NAME from EMPLOYEES where extract(month from HIRE_DATE) = 5

and for the other query, try

COMMISSION_PCT is null
    
answered by 21.05.2018 в 17:43