Giter VIP home page Giter VIP logo

assignment_analytical's Introduction

Assignment_analytical

--Monthly transactions-- #Need how much amount we have processed each month commutative and every month. select LPAD(CAST(EXTRACT(MONTH from transaction_timestamp) as string),2,'0') as yearmonth , billing_amount from test-bigquery-383510.tran_dataset.transactions ;

--Most Popular Products/Services-- #identify the top 5 most popular products or services based on transaction counts. SELECT merchant_name, merchant_type, count(transaction_amount) as tran_count

FROM

`test-bigquery-383510.tran_dataset.transactions`

group by 1,2
order by tran_count desc
limit 5
;

--Daily Revenue Trend-- #Formulate a SQL query to visualize the daily revenue trend over time. select datetime_trunc(transaction_timestamp, DAY) AS DAY , transaction_amount as revenue from test-bigquery-383510.tran_dataset.transactions;

--Average Transaction Amount by Product Category-- #Formulate a SQL query to find the average transaction amount for each product category.

select merchant_type , round(avg(transaction_amount),2) as average_transaction_amount from test-bigquery-383510.tran_dataset.transactions group by merchant_type order by 2 asc ;

--Transaction Funnel Analysis-- #Create a SQL query to analyze the transaction funnel, including completed, pending, and cancelled transactions.

select *, (case when transaction_type = 'PURCHASE' then 'Complete transactions' when transaction_type = 'ACCOUNT_VERIFICATION' then 'Pending transactions' when transaction_type = 'CASH_WITHDRAWAL' then 'Pending transactions' when transaction_type = 'REFUND' then 'Cancelled transactions' end) as transaction_funnel

from test-bigquery-383510.tran_dataset.transactions;

--Monthly Retention Rate-- #Design a SQL query to calculate the Monthly Retention Rate, grouping users into monthly cohorts.

select a.user_id, a.MONTH, a.FIRST FROM (SELECT user_id , FORMAT_DATETIME("%b", transaction_timestamp) as MONTH , min(FORMAT_DATETIME("%b", transaction_timestamp)) as FIRST

FROM test-bigquery-383510.tran_dataset.transactions GROUP BY user_id ,FORMAT_DATETIME("%b", transaction_timestamp) )a ;

SELECT count(user_id), (CASE WHEN MONTH = 'Jan' THEN 'Jan' ELSE 'MONTH' END) AS Month_1, (CASE WHEN MONTH = 'Feb' THEN 'Feb' ELSE 'MONTH' END) AS Month_2 from (select a.user_id, a.MONTH, a.FIRST FROM (SELECT user_id , FORMAT_DATETIME("%b", transaction_timestamp) as MONTH , min(FORMAT_DATETIME("%b", transaction_timestamp)) as FIRST

FROM test-bigquery-383510.tran_dataset.transactions GROUP BY user_id ,FORMAT_DATETIME("%b", transaction_timestamp) )a ) group by 2,3;

assignment_analytical's People

Contributors

prashantsagar38 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.