Challenge

Project 1

Here is my project 1 on mySQL :

Intro:

Business model Customer to Customer (C2C) allows customers to do business with each other. This model is growing fast with e-commerce platforms where sellers may be required to pay some amount and buyer can buy it without paying anything. E-Commerce website brings the seller and buyer to the same platform. 

Analyzing the user's database will lead to understanding the business perspective. Behaviour of the users can be traced in terms of business with exploration of the user’s database. 

Dataset: One .csv file with name users_data with 98913 rows and 24 columns

Tasks to be performed

1.Create new schema as ecommerce

ans: CREATE DATABASE ECOMMERCE;

2.Import .csv file users_data into MySQL
(right click on ecommerce schema -> Table Data import Wizard -> Give path of the file -> Next -> choose options : Create a new table , select delete if exist -> next -> next)

ans: users_data.csv table data imported by following above procedure.

3.Run SQL command to see the structure of table

ans: DESCRIBE USERS_DATA;

4.Run SQL command to select first 100 rows of the database

ans : SELECT * FROM USERS_DATA limit 100;

5.How many distinct values exist in table for field country and language

ans : SELECT COUNT(distinct(COUNTRY)),COUNT(distinct(LANGUAGE)) FROM USERS_DATA;

6.Check whether male users are having maximum followers or female users.

ans : SELECT gender, MAX(socialNbFollowers) max_followers FROM Users_data GROUP BY gender;

7.Calculate the total users those

  a. Uses Profile Picture in their Profile

   ans: SELECT COUNT(hasProfilePicture) FROM USERS_DATA WHERE hasProfilePicture = 'TRUE';

   b.Uses Application for Ecommerce platform

   ans:  SELECT  COUNT(hasAnyApp) FROM USERS_DATA WHERE hasAnyApp = 'TRUE';

    c.Uses Android app

    ans :  SELECT  COUNT(hasAndroidApp) FROM USERS_DATA WHERE hasAndroidApp = 'TRUE';

    d. Uses ios app

    ans :  SELECT  COUNT(hasIosApp) FROM USERS_DATA WHERE hasIosApp = 'TRUE';

8. Calculate the total number of buyers for each country and sort the result in descending order of total                    number  of  buyers. (Hint: consider only those users having at least 1 product bought.)

ans :SELECT COUNTRY,count(*) productsBought FROM USERS_DATA WHERE productsBought >= 1 group by country              order by productsBought desc;

9.Calculate the total number of sellers for each country and sort the result in ascending order of total number       of  sellers.(Hint: consider only those users having at least 1 product sold.)

ans:SELECT country ,count(*) productsSold FROM USERS_DATA WHERE productsSold >= 1 group by country order by           productsSold asc;

10.Display name of top 10 countries having maximum products pass rate.

ans : SELECT DISTINCT(COUNTRY),productsPassRate FROM USERS_DATA ORDER BY productsPassRate DESC LIMIT 10;

11.Calculate the number of users on an ecommerce platform for different language choices.

ans: SELECT language,count(*) no_of_users_for_different_language_choices FROM USERS_DATA group by language;

12.Check the choice of female users about putting the product in a wishlist or to like socially on an ecommerce platform. (Hint: use UNION to answer this question.)

ans :

SELECT 'Wishlist'  choice,count(gender) Female_count  FROM users_data WHERE gender= 'F' AND productsWished>=1 
UNION
SELECT  'Like' choice, count(gender) Female_count FROM users_data WHERE gender= 'F' AND socialProductsLiked >=1;

13.Check the choice of male users about being seller or buyer. (Hint: use UNION to solve this question.)

ans:

SELECT 'Seller' choice, count(gender) male_count  FROM users_data WHERE gender = 'M' AND productsSold >= 1 
UNION
SELECT  'Buyer' choice, count(gender) male_count FROM users_data WHERE gender = 'M' AND productsBought >= 1;

14.Which country is having maximum number of buyers?

ans:

SELECT country, COUNT(*) AS num_buyers FROM users_data WHERE productsBought >= 1
GROUP BY country
ORDER BY num_buyers DESC LIMIT 1;

15.List the name of 10 countries having zero number of sellers.

ans: SELECT country ,productsSold from users_data where productsSold = 0 limit 10 ;

16.Display record of top 110 users who have used ecommerce platform recently.

ans : SELECT * FROM USERS_DATA ORDER BY daysSinceLastLogin ASC LIMIT 110;

17.Calculate the number of female users those who have not logged in since last 100 days.

ans : SELECT gender,count(gender) FROM USERS_DATA WHERE daysSinceLastLogin = 100 and gender = 'F';

18.Display the number of female users of each country at ecommerce platform.

ans :SELECT COUNTRY ,count(gender) no_of_females FROM USERS_DATA WHERE GENDER = 'F' group by country;

19.Display the number of male users of each country at ecommerce platform.

ans : SELECT country ,count(*) no_of_males from users_data where gender ='M' group by country;

20.Calculate the average number of products sold and bought on ecommerce platform by male users for each country.

ans: SELECT COUNTRY, AVG(productsSold) ,AVG(productsBought) FROM USERS_DATA WHERE GENDER ='M' GROUP BY COUNTRY;

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.