Professional Documents
Culture Documents
code:
age INT,
gender VARCHAR(10),
religion VARCHAR(20),
caste VARCHAR(20),
city VARCHAR(50),
district VARCHAR(50),
state VARCHAR(50),
);
Data:
INSERT INTO population_country (id, name, age, gender, religion, caste, city, district, state)
VALUES
(1, 'Amit Kumar', 32, 'Male', 'Hindu', 'SC', 'Patna', 'Patna', 'Bihar'),
(2, 'Rajesh Singh', 27, 'Male', 'Hindu', 'ST', 'Jamshedpur', 'East Singhbhum', 'Jharkhand'),
(3, 'Gopal Sharma', 45, 'Male', 'Hindu', 'General', 'Kolkata', 'North 24 Parganas', 'West Bengal'),
(4, 'Anil Singh', 18, 'Male', 'Hindu', 'SC', 'Bhagalpur', 'Bhagalpur', 'Bihar'),
(5, 'Sunil Yadav', 38, 'Male', 'Hindu', 'ST', 'Purulia', 'Purulia', 'West Bengal'),
(6, 'Suresh Patel', 26, 'Male', 'Hindu', 'General', 'Darbhanga', 'Darbhanga', 'Bihar'),
(7, 'Alok Singh', 40, 'Male', 'Sikh', 'General', 'Kolkata', 'Kolkata', 'West Bengal'),
(8, 'Jasdeep Kaur', 29, 'Female', 'Sikh', 'General', 'Patna', 'Patna', 'Bihar'),
(9, 'Priya Mishra', 22, 'Female', 'Hindu', 'SC', 'Gaya', 'Gaya', 'Bihar'),
(10, 'Renuka Devi', 35, 'Female', 'Hindu', 'ST', 'Munger', 'Munger', 'Bihar'),
(12, 'Mohan Sharma', 12, 'Child', 'Hindu', 'ST', 'Purulia', 'Purulia', 'West Bengal'),
(13, 'Arun Kumar', 5, 'Child', 'Hindu', 'General', 'Kolkata', 'North 24 Parganas', 'West Bengal'),
(15, 'Kamaljeet Kaur', 34, 'Transgender', 'Sikh', 'General', 'Patna', 'Patna', 'Bihar'),
(16, 'Sandeep Singh', 21, 'Transgender', 'Hindu', 'SC', 'Asansol', 'Paschim Bardhaman', 'West Bengal'),
(17, 'Nisha Devi', 27, 'Transgender', 'Hindu', 'ST', 'Gaya', 'Gaya', 'Bihar');
2. Find out the no. of child whose age is between 5-10 years in Bihar.
8. List the female members whose age is less than 40 years from different states.
9. Find the number of male and female persons in India state wise.
10. List the state where maximum number of male persons whose age is more than 50 years.
11. Count the number of people in India state wise where they belong in SC and ST category.
12. Find the district in west Bengal where population is more in number.
13. Find the districts and it’s state where the population is below 5 lakhs.
14. Find the count of male and female persons in the district Hooghly, West Bengal.
FROM population_country
GROUP BY gender;
SELECT COUNT(*) AS count
FROM population_country
SELECT name
FROM population_country
FROM population_country
FROM population_country
GROUP BY state;
FROM population_country
WHERE gender = 'Female'
GROUP BY district
HAVING COUNT(*) > (SELECT COUNT(*)/2 FROM population_country WHERE gender = 'Male')
FROM population_country
GROUP BY state
FROM population_country
FROM population_country
FROM population_country
GROUP BY state
LIMIT 1;
FROM population_country
FROM population_country
GROUP BY district
LIMIT 1;
FROM population_country
FROM population_country
GROUP BY gender;