Oracle Tutorial Date Function - 2

Опубликовано: 21 Октябрь 2024
на канале: Ganesh Anbarasu
1,022
13

Oracle Date Function, Order by Month Year. Getting employee count hired month, yearwise and order by hiring month and year.

SQL Used in the video below.
select * from employees order by hire_date;

select hire_date,to_char(hire_date,'Month,YYYY') from employees;


select to_char(hire_date,'Month,YYYY')Month_Year,count(*) No_Of_Employees
from employees
group by to_char(hire_date,'Month,YYYY')
order by to_char(hire_date,'Month,YYYY')


select to_char(hire_date,'Month,YYYY')Month_Year,count(*) No_Of_Employees
from employees
group by to_char(hire_date,'Month,YYYY')
order by to_date(to_char(hire_date,'Month,YYYY'),'Month,YYYY')

select replace(to_char(hire_date,'Month,YYYY'),' ','')Month_Year,count(*) No_Of_Employees
from employees
group by to_char(hire_date,'Month,YYYY')
order by to_date(to_char(hire_date,'Month,YYYY'),'Month,YYYY')