E - COMMERCE PLATFORM
AIM : To bring the seller and buyer to the same platform called ecommerce website. Where Business model customer to customer(C2C) allows customer to do business with each other.
#Q1
USE ecommerce;
#Q2
SELECT * FROM users_data;
#Q3
DESC users_data;
#Q4
SELECT * FROM users_data LIMIT 100;
#Q5
SELECT COUNT( DISTINCT country ), COUNT(DISTINCT language) FROM users_data;
#Q6
SELECT SUM(socialNbFollowers),gender FROM users_data GROUP BY gender;
#Q7
SELECT COUNT(*) as profilepic FROM users_data WHERE hasProfilePicture= 'TRUE';
SELECT COUNT(*) as anyapp FROM users_data WHERE hasAnyApp = 'TRUE';
SELECT COUNT(*) as androidapp FROM users_data WHERE hasAndroidApp = 'TRUE';
SELECT COUNT(*) as iosapp FROM users_data WHERE hasIosApp = 'TRUE';
#Q8
SELECT country,count(productsBought) FROM users_data WHERE productsBought > 0 GROUP BY country ORDER by COUNT(productsBought) DESC;
#Q9
SELECT country , count(productsSold) FROM users_data where productsSold > 0 GROUP BY country ORDER BY SUM(productsSold);
#Q10
SELECT country,max(productsPassRate) FROM users_data group by country LIMIT 10;
#Q11
SELECT language, COUNT(*) FROM users_data GROUP BY language;
#Q12
SELECT ' pw' , SUM(productsWished) FROM users_data
union
select 'pl' , SUM(socialproductsLiked) from users_data
where gender = 'F';
#Q13
SELECT SUM(productsSold) FROM users_data WHERE gender= 'M' UNION
SELECT SUM(productsBought) FROM users_data WHERE gender ='M' ;
#Q14
SELECT country, MAX(productsBought) FROM users_data where productsBought >0 group by country limit 1;
#Q15
SELECT country, productsSold FROM users_data WHERE productsSold=0 LIMIT 10;
#Q16
SELECT daysSinceLastLogin FROM userdata LIMIT 110;
#Q17
SELECT SUM(daysSinceLastLogin) FROM userdata WHERE daysSinceLastLogin >100 AND gender = 'F';
#Q!8
SELECT gender,country, COUNT(*) FROM userdata WHERE gender = 'F' GROUP BY country;
#Q19
SELECT gender,country, COUNT(*) FROM userdata WHERE gender = 'M' GROUP BY country;
#Q20
SELECT gender, country, AVG(productsSold), AVG(productsBought) FROM userdata WHERE gender = 'M' GROUP BY country;