Project 1
Q1.create database ecommerce;
Q2.Imported to sql
Q3.desc users_data;
describe users_data;
Q5.select count(distinct country) country, count(distinct language) language from users_data;
Q6.select gender,sum(socialNbFollowers) from users_data group by gender;
select gender,max(socialNbFollowers) greatest_followers from users_data where gender =("M"or"F");
select gender,count(socialNbFollowers) from users_data where gender="M";
select gender,count(socialNbFollowers) from users_data where gender="F";
Q7.a)select count(hasProfilePicture) Total_users from users_data where hasProfilePicture = 'True';
b)select count(hasAnyApp) Total_users from users_data where hasAnyApp = 'True';
c)select count(hasAndroidApp) Total_users from users_data where hasAndroidApp = 'True';
d)select count(hasIosApp) Total_users from users_data where hasIosApp = 'True';
Q8.select country, count(productsBought) Buyers from users_data group by country order by Buyers desc;
Q9.select country, count(productsSold) Sellers from users_data group by country order by Sellers asc;
Q10.select country from users_data group by country having max (productsPassRate) limit 10;
Q11.select language, count(language) from users_data group by language;
Q12.select 'Description', 'No. of units' union select 'Products Social Liked', sum(socialProductsLiked) from users_data where gender = 'F'union select 'Products wishlisted', sum(productsWished) wishlisted from users_data where gender = 'F';
Q13.select 'Description', 'No. of people' union select 'sellers(male)',count(productsListed) from users_data where gender = 'F' and productsListed>0 union select 'Buyers(male)',count(productsBought)from users_data where gender = 'M' and productsBought>0;
Q14.select country,count(productsBought) as buyers from users_data where productsBought>0 group by country order by buyers desc limit 1;
Q15.select country,sum(productsListed) as zerolist from users_data group by country order by zerolist limit 10;
Q16.select identifierHash,daysSinceLastLogin from users_data order by daysSinceLastLogin limit 10;
Q17.select count(identifierHash) as femaleusers from users_data where gender = 'F' and daysSinceLastLogin>100;
Q18.select country,count(identifierHash) as femaleusers from users_data where gender = 'F' group by country;
Q19.select country,count(identifierHash) as maleusers from users_data where gender = 'M' group by country;
Q20.select country,avg(productsSold),avg(productsBought) from users_data where gender = 'M' group by country;