Skip to main content

Data Analysis Project 1 Ola

 I have 1 Lakhs rows Random data of Ola Ride


Step I'm following here 

  1.  Data Cleaning
    1. '' failed to upload. Invalid response: RpcError
    2. Remove Duplicate 
      Data Tab on Ribon --->
    3. Trim Whitespace
      Sabhi me nhi aa rha ab













Lets Start on SQL ====================
1) Import CSV file , go to schema and then Table Data Import wizard  

  1. Import CSV File, go to Schema and Then table data import wizard
  2. Now Solving Problems One by One 
    1. First Question is: #Retrieve all successful bookings from data:
      Ans: 
CREATE database Ola;
Use Ola;
#Retrieve all successful bookings from data:
Create View Successful_Bookings As #jab bhi ham koi output nikalte hai, temporary form me store krke rakh rhe
Select * From newbooking
WHERE `Booking Status` = 'Success';
Select * From Successful_Bookings;

Explain ===========

1️⃣ Database Creation

CREATE DATABASE Ola; USE Ola;

Explanation:

  • CREATE DATABASE Ola; → नया database Ola बनाता है।

  • USE Ola; → अब जो भी commands देंगे, वो Ola database में apply होंगे।

2️⃣ Retrieve Successful Bookings Using View

Create View Successful_Bookings As Select * From newbooking WHERE `Booking Status` = 'Success';

Step-by-Step Explanation:

  1. CREATE VIEW Successful_Bookings AS

    • यह command एक View बनाता है।

    • View: एक temporary/virtual table है।

      • Data original table से copy नहीं होता, सिर्फ query save होती है।

      • जब भी आप view को query करेंगे, latest data fetch होता है।

    • View का नाम यहाँ: Successful_Bookings

  2. SELECT * FROM newbooking

    • newbooking table से सभी columns select होंगे।

    • * का मतलब: table का पूरा data।

  3. WHERE Booking Status = 'Success'

    • Filter condition: केवल वो rows select होंगी जिनकी Booking Status success है।

    • Note: Column name में space होने की वजह से backticks ` ` का use किया गया है।

3️⃣ View से Data Access करना
    • Select * From Successful_Bookings;

      Explanation:

      • अब आप view को table की तरह query कर सकते हैं।

      • इससे केवल successful bookings show होंगी।

      • Advantages of using View:

        1. बार-बार लिखी जाने वाली complex query save हो जाती है।

        2. Live data automatically update होता है अगर original table change होता है।

        3. Simplifies reporting और analysis।

  1. Question: Get the total number of cancelled rides by customers
    1. Ans: 
SELECT COUNT(*) from newbooking
WHERE `Booking Status` = 'Canceled_by_Customer';

Step-by-Step Explanation:


1️⃣ SELECT COUNT(*)

  • COUNT(*) एक aggregate function है।

  • इसका काम: rows की total संख्या गिनना

  • * मतलब: हर row को count करो, चाहे उसमें NULL values हों या नहीं।

2️⃣ FROM newbooking

  • newbooking table से data fetch किया जा रहा है।

  • मतलब, rows की गिनती इस table के context में होगी।

3️⃣ WHERE Booking Status = 'Canceled_by_Customer'

  • WHERE clause filter apply करता है।

  • केवल वो rows count होंगी जिनकी Booking Status column value Canceled_by_Customer है।

  • ध्यान: column name में space है इसलिए backticks `Booking Status` use किए गए हैं।


4️⃣ पूरा मतलब

  • यह query आपको बताती है कि newbooking table में कितनी bookings customers द्वारा cancel की गई हैं।

3.Question: List the top 5 customer who booked the hightes number of ride
Ans: 
SELECT `Customer Id`, COUNT(`BOOKING ID`) as total_rides
from newbooking
GROUP BY `Customer Id`
ORDER BY total_rides DESC LIMIT 5;


Step-by-Step Notes


1️⃣ SELECT Customer Id, COUNT(Booking ID) AS total_rides

  • Customer Id → यह column बताता है कि ride किस customer ने book की।

  • COUNT(Booking ID) → यह aggregate function है जो हर customer की total rides count करता है।

  • AS total_rides → यह counted column का नया नाम है।

मतलब: यहाँ हम हर customer के rides की संख्या निकाल रहे हैं।


2️⃣ FROM newbooking

  • Data source: newbooking table

  • यानि हम वही table use कर रहे हैं जिसमें सारे ride details हैं।


3️⃣ GROUP BY Customer Id

  • GROUP BYrows को customer के हिसाब से group करता है।

  • मतलब: एक ही customer की सारी bookings एक group में आएँगी।

  • हर customer के लिए एक row generate होगी।


4️⃣ ORDER BY total_rides DESC

  • ORDER BY → data को sort करता है।

  • DESC → descending order, यानी सबसे ज्यादा rides वाले customer पहले आएँ।


5️⃣ LIMIT 5

  • LIMIT → सिर्फ top 5 rows दिखाए।

  • मतलब यह query आपको बताएगी कि कौन-कौन से 5 customers ने सबसे ज्यादा rides की

  1. Question:Find the maximum and minimum driver rating for prime sedan booking; 
    Ans: 
SELECT 
    MAX(`Driver Ratings`) AS max_rating,
    MIN(`Driver Ratings`) AS min_rating
FROM newbooking
WHERE `Vehicle Type` = 'Prime Sedan';

Comments

Popular posts from this blog

Python Final Lectures

 Q- how to Print Hello World print("Hello World") Variables in python ------- age = 30   #variable should be intutive so that we can learn any time print(age) Note: Shift+Enter is shortcut to run command 2) ' #' this is for writing the comment in python Rules for Variables--- Variable can not be start with any number like - 1age  Number can use in between and end with variable like - age1 age2 Special characters are not allowed expect _ (underscore) like - age_my Space not allowed in variable  Python is case sensitive  Way to define Variable --- age1,age2 = 30,25  age1 = 30 age2 = 25 age1=age2=30   #if 30 age for both variable   >> Data type the type of data is basically data type Integer = age1 to age3 is basically integer   , Integer is basically full number lets check = type(age1)  #it will give u print int float=  basically decimal values Interest =  30.24 type(Interest) #answer is float Message = ...

SQL and rest python for Data analysis

SQL (Structured Query Language) की ओर — ये डेटा हैंडलिंग का अगला स्टेप है, जहाँ हम database से data को fetch, update, delete, filter, aur organize करना सीखते हैं। 💾 SQL क्या है (What is SQL)? SQL का मतलब है Structured Query Language — ये एक database language है जिसका इस्तेमाल data को store, access, और manage करने के लिए किया जाता है। जैसे Excel में data sheets होती हैं, वैसे SQL में tables होती हैं। Type Keyword Use 1️⃣ DDL (Data Definition Language) CREATE , ALTER , DROP Database structure change करने के लिए 2️⃣ DML (Data Manipulation Language) INSERT , UPDATE , DELETE Data change करने के लिए 3️⃣ DQL (Data Query Language) SELECT Data निकालने के लिए 4️⃣ DCL (Data Control Language) GRANT , REVOKE Permission देने या हटाने के लिए 5️⃣ TCL (Transaction Control Language) COMMIT , ROLLBACK Changes को confirm या cancel करने के लिए Download MY SQL From Google >>>Lets learn this concept compare with excel Concept in SQL Excel Equivalen...

Add CSS using external CSS

>>> U just need to create a another page and save it with the name style.css >>> and then go to link that style page with your html docs how to link your css with html page ? >>> You can find code below , it will help you to link your external page with your html docs <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Divyanshu Khare || MERN Developer</title> <meta description = "description" content="Divyanshu Khare's website"> <link rel="stylesheet" type="text/css" href="style.css">   <!----------link external css page ---------> </head> <body> </body> </html>