+ 1

Could you help me with this query?

given a teacher table to determine how many teacher have been hired each year the output would be the year and how many hired in that year

18th May 2018, 3:24 AM
CRISTHIAN JUMBO
CRISTHIAN JUMBO - avatar
4 ответов
+ 2
SELECT teacher_name, id FROM teachers WHERE year_hired = given_year something like that?
18th May 2018, 3:56 AM
Akib
Akib - avatar
+ 2
Use <= or a Function
18th May 2018, 5:19 AM
Akib
Akib - avatar
+ 1
But I also want of other years in the same query ??
18th May 2018, 4:03 AM
CRISTHIAN JUMBO
CRISTHIAN JUMBO - avatar
+ 1
1.- If you have...create table Create table teacher (id int not null autoincrement PRIMARY KEY, name varchar(250) not null, hire_date date not null) 2.- You can do this: select datepart(YEAR,hire_date) as Year, count(id) as hired_teachers from teacher group by datepart(YEAR,hire_date) 3.- the result sum all registres agrouped by year of hire_date
26th May 2018, 2:40 AM
Pablo David Quintana Erazo
Pablo David Quintana Erazo - avatar