Aggregation
Last updated
Was this helpful?
Last updated
Was this helpful?
select count(*) from CITY
where POPULATION > 100000;
select sum(POPULATION) from CITY
where DISTRICT = 'California';
select avg(POPULATION) from CITY
where DISTRICT = 'California';
select round(avg(POPULATION)) from CITY;
select sum(POPULATION) from CITY
where COUNTRYCODE = 'JPN';
select max(POPULATION) - min(POPULATION) from CITY;
select ceil(avg(Salary) - avg(replace(Salary, '0', ''))) from EMPLOYEES;
select * from (
select salary * months, count(*) from Employee
group by salary * months
order by 1 desc)
where rownum = 1;
select round(sum(LAT_N),2), round(sum(LONG_W),2) from STATION;
select round(sum(LAT_N), 4) from STATION
where LAT_N > 38.7880 and LAT_N < 137.2345;
select trunc(max(LAT_N),4) from STATION
where LAT_N < 137.2345;
select round(LONG_W,4) from STATION
where LAT_N = (select max(LAT_N) from STATION where LAT_N < 137.2345);
select round(min(LAT_N),4) from STATION
where LAT_N > 38.7780;
select * from (
select round(LONG_W, 4) from STATION
where LAT_N > 38.7780
order by LAT_N asc)
where rownum = 1;
select round(((max(LAT_N) - min(LAT_N)) + (max(LONG_W) - min(LONG_W))),4)
from STATION;
select round(sqrt(
power((max(LAT_N) - min(LAT_N)),2) +
power((max(LONG_W) - min(LONG_W)),2)
),4)
from STATION;
select round(median(LAT_N),4) from STATION;