Project 1
Solutions
create database ecommerce;
---- imported .csv file users_data into MySQL----
Desc users_data;
select * from users_data limit 100;
select count(distinct country), count(distinct language) from users_data;
select count(socialNbFollowers), gender from users_data
group by gender;
select count(hasProfilePicture) from users_data
where hasProfilePicture ='true';
select count(hasanyapp)from users_data
where hasanyapp = 'true';
select count(hasandroidapp)from users_data
where hasandroidapp = 'true';
select count(hasiosapp) from users_data
where hasiosapp = 'true';
select country, sum(productsbought) from users_data
where productsbought >= 1 group by country
order by sum(productsBought) desc;
select country, sum(productssold) from users_data
where productssold >= 1 group by country
order by sum(productssold) asc;
select distinct country,productspassrate from users_data ------
where any(country) = max(productspassrate)
group by country
order by max(productspassrate);
select distinct language, sum(language) from users_data -----
group by language;
order by sum(all language);
select socialproductsliked, productswished from users_data ----
where socialProductsLiked >=1 or productsWished >=1
group by gender;
#### 13####
select country, max(productsBought),sum(productsBought) from users_data
where productsBought>=0
group by country
order by sum(productsbought) desc;
select country,sum(productssold) from users_data ------
where sum(productssold) = 0
group by country
order by sum(productssold) limit 10;
select country, count(gender) total_female from users_data
WHERE gender = 'f'
group by country
order by count(gender);
select country, count(gender) total_male from users_data
WHERE gender = 'm'
group by country
order by count(gender);
select country, avg(productsSold), avg(productsBought), count(gender) from users_data
WHERE gender = 'm'
group by country;