Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

census #4

Open
goku-1995 opened this issue Apr 30, 2024 · 0 comments
Open

census #4

goku-1995 opened this issue Apr 30, 2024 · 0 comments

Comments

@goku-1995
Copy link

-- select * from dataset1;
-- select * from dataset2;

-- number of rows in our dataset
-- select count() from dataset1;
-- select count(
) from dataset2;

-- Dataset for UP and Bihar
-- select * from dataset1 where state in ("bihar" , "Uttarpradesh");
-- select * from dataset2 where state in ("bihar" , "Uttarpradesh");

-- Population of india
-- select sum(population) as population from dataset2;
-- select state, sum(population) as population from dataset2 group by state;
-- select state, sum(population) as population from dataset2 group by state order by population desc;

-- Average growth
-- select avg(growth) as avg_growth from dataset1;
-- select state, avg(growth) *100 as avg_growth from dataset1 group by state;
-- select state, round(avg(growth),0) *100 as avg_growth from dataset1 group by state;

-- Sex ratio
-- select state, round(avg(sex_ratio),0) as avg_sex_ratio from dataset1 group by state order by avg_sex_ratio desc;

-- Average litracy rate
-- select state, round(avg(literacy),0) as avg_literacy from dataset1 group by state order by avg_literacy desc;
-- select state, round(avg(literacy),0) as avg_literacy from dataset1 group by state having round(avg(literacy),0)>90 order by avg_literacy desc;

-- Top 3 state showig highest growth ratio
select state, avg(growth) as avg_growth from dataset1 group by state order by avg_growth desc limit 3 ;

Bottom 3 state showing the lowest sex ratio
-- select state, round(avg(sex_ratio),0) as avg_sex_ratio from dataset1 group by state order by avg_sex_ratio ASC limit 3;

-- top and bottom 3 state in literacy state
-- (select state, Literacy from dataset1 order by Literacy desc limit 3)
-- union all
-- (select state, Literacy from dataset1 order by Literacy asc limit 3);

-- state staring with the letter A
select distinct state from dataset1 where lower(state) like 'A%'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant