DataScience Atlas
DataScience Atlas
  • 249
  • 51 189
Agrim Business Analyst Interview- SQL Query Part 1
Agrim SQL Interview Question: A question very similar to this was asked, in one of the rounds of interviews at Agrim (Tech Rounds - SQL Round).
Agrim Business Analyst Interview- Learn sql by attempting this SQL Query
#data analyst #data science #sql
มุมมอง: 25

วีดีโอ

Agrim Business Analyst Interview- SQL Query Part 2
มุมมอง 116 ชั่วโมงที่ผ่านมา
Agrim SQL Interview Question: A question very similar to this was asked, in one of the rounds of interviews at Agrim (Tech Rounds - SQL Round). Agrim Business Analyst Interview- Learn sql by attempting this SQL Query #data analyst #data science #sql
Zomato Senior Business Analyst Interview- SQL Query
มุมมอง 66วันที่ผ่านมา
Zomato SQL Interview Question: A question very similar to this was asked, in one of the rounds of interviews at Zomato (Tech Rounds - SQL Round). Zomato Business Analyst Interview- Learn sql by attempting this SQL Query #data analyst #data science #sql Table Creation Code(DDL): /* CREATE TABLE orders ( timestamp TIMESTAMPTZ NOT NULL, city VARCHAR(50) NOT NULL, order_id SERIAL PRIMARY KEY, custo...
Zepto Business Analyst Interview- SQL Query
มุมมอง 11314 วันที่ผ่านมา
A question very similar to this was asked, in one of the rounds of interviews at Zepto. Zepto Business Analyst Interview- SQL Query #data analyst #data science #sql Table Creation Code(DDL): /* CREATE TABLE Sessions ( Cust_ID INT, Timestamp timestamp, Searched_for VARCHAR(50) ); INSERT INTO Sessions (Cust_ID, Timestamp, Searched_for) VALUES (1, '2024-08-01 08:00:00', 'Item A'), (2, '2024-08-01 ...
Swiggy Business Analyst Interview- SQL Query
มุมมอง 7621 วันที่ผ่านมา
Swiggy SQL Interview Question : A sql question very similar to this was asked to me in one of the rounds of interviews at Swiggy. #data analyst #data science #sql Table Creation Code(DDL): /*CREATE TABLE Orders ( Order_id INT, is_defective BOOLEAN, order_timestamp timestamp, is_completed BOOLEAN ); INSERT INTO Orders (Order_id, is_defective, order_timestamp, is_completed) VALUES (1, TRUE, '2024...
Paypal Data Analyst Interview(part 2)- SQL Query
มุมมอง 8721 วันที่ผ่านมา
A question very similar to this was asked to me in one of the rounds of interviews at Paypal. #data analyst #data science #sql #paypal #paypal sql #paypal sql interview #paypal interview #data analyst. Paypal SQL Interview (Interview Question)
Paypal Data Analyst Interview(part 1)- SQL Query
มุมมอง 13528 วันที่ผ่านมา
A question very similar to this was asked to me in one of the rounds of interviews at Paypal. #data analyst #data science #sql #paypal #paypal sql #paypal sql interview #paypal interview #data analyst Watch this video - Paypal SQL Interview. (Interview Question)
Expedia Senior Analyst Interview - SQL Query #data analyst #data science #sql
มุมมอง 30หลายเดือนก่อน
Expedia Business Analyst/ Senior Analyst Interview Question : A question very similar to this was asked to me in one of the rounds of interviews at Meesho. #data analyst #data science #sql Table Creation Code(DDL): CREATE TABLE Video_Reviews ( Video_ID VARCHAR(10), Flag_ID VARCHAR(10), Reviewed_by_YT BOOLEAN, Reviewed_date DATE, Reviewed_outcome VARCHAR(20) ); INSERT INTO Video_Reviews (Video_I...
Ola Business Case Study : Interview Question
มุมมอง 22หลายเดือนก่อน
Ola Business Case Study : Prepare for business case study, insightful for business analysts, data analysts, data scientists. #datascience , #machinelearning , #python , #artificialintelligence , #ai , #data , #dataanalytics, #bigdata , #programming , #coding , #datascientist , #technology , #deeplearning , #computerscience , #datavisualization , #analytics , #pythonprogramming , #tech , #iot , ...
KOTAK 811 Business Analyst Interview 1 - SQL Query #data analyst #data science #sql
มุมมอง 103หลายเดือนก่อน
A question very similar to this was asked in one of the rounds of interviews at KOTAK. #data analyst #data science #sql Table Creation Code(DDL): CREATE TABLE Tweets ( User_id INT, timestamp DATE, tweet_content TEXT ); INSERT INTO Tweets (User_id, timestamp, tweet_content) VALUES (1, '2024-01-01 08:00:00', 'Good morning, world!'); INSERT INTO Tweets (User_id, timestamp, tweet_content) VALUES (2...
Joins SQL For Interview
มุมมอง 54หลายเดือนก่อน
Learn all about SQL joins for your next interview! This video covers everything you need to know about SQL joins to ace your interview. #datascience , #machinelearning , #python , #artificialintelligence , #ai , #data , #dataanalytics, #bigdata , #programming , #coding , #datascientist , #technology , #deeplearning , #computerscience , #datavisualization , #analytics , #pythonprogramming , #tec...
Robinhood SQL Interview Practice Question
มุมมอง 81หลายเดือนก่อน
#datascience , #machinelearning , #python , #artificialintelligence , #ai , #data , #dataanalytics, #bigdata , #programming , #coding , #datascientist , #technology , #deeplearning , #computerscience , #datavisualization , #analytics , #pythonprogramming , #tech , #iot , #dataanalysis , #java , #developer , #programmer , #business , #ml , #database , #software , #javascript , #statistics , #inn...
Episode 8 Z Scores #statistics #datascience #dataanalytics
มุมมอง 25หลายเดือนก่อน
#datascience , #machinelearning , #python , #artificialintelligence , #ai , #data , #dataanalytics, #bigdata , #programming , #coding , #datascientist , #technology , #deeplearning , #computerscience , #datavisualization , #analytics , #pythonprogramming , #tech , #iot , #dataanalysis , #java , #developer , #programmer , #business , #ml , #database , #software , #javascript , #statistics , #inn...
GOOGLE Business Analyst Interview 1 - SQL Query #data analyst #data science #sql
มุมมอง 365หลายเดือนก่อน
GOOGLE Business Analyst Interview 1 - SQL Query #data analyst #data science #sql
Episode 7 Gaussian Distributions #statistics #datascience #dataanalytics
มุมมอง 642 หลายเดือนก่อน
Episode 7 Gaussian Distributions #statistics #datascience #dataanalytics
Case Study 1 Food Delivery Application #datascience #case study #dataanalytics #dataanalysis
มุมมอง 652 หลายเดือนก่อน
Case Study 1 Food Delivery Application #datascience #case study #dataanalytics #dataanalysis
Facebook SQL Interview Practice Question #dataanalyst #sql #datascience
มุมมอง 742 หลายเดือนก่อน
Facebook SQL Interview Practice Question #dataanalyst #sql #datascience
UnitedHealth SQL Practice Interview Question #dataanalyst #machinelearning #sql #datascience
มุมมอง 162 หลายเดือนก่อน
UnitedHealth SQL Practice Interview Question #dataanalyst #machinelearning #sql #datascience
AB Testing Part 1 #datascience #datascientist #ab test
มุมมอง 572 หลายเดือนก่อน
AB Testing Part 1 #datascience #datascientist #ab test
Alibaba SQL Practice Interview Question #dataanalyst #sql #datascience
มุมมอง 472 หลายเดือนก่อน
Alibaba SQL Practice Interview Question #dataanalyst #sql #datascience
Linkedin Practice SQL Interview Question
มุมมอง 1552 หลายเดือนก่อน
Linkedin Practice SQL Interview Question
Tesla SQL Interview Practice Question #sql #datascience #machinelearning
มุมมอง 392 หลายเดือนก่อน
Tesla SQL Interview Practice Question #sql #datascience #machinelearning
LeetCode SQL Interview Practice Question (Question 570) #sql, #datascience, #machinelearning
มุมมอง 612 หลายเดือนก่อน
LeetCode SQL Interview Practice Question (Question 570) #sql, #datascience, #machinelearning
Microsoft SQL Interview Question ( Practice )#sql #datascience #dataanalyst
มุมมอง 453 หลายเดือนก่อน
Microsoft SQL Interview Question ( Practice )#sql #datascience #dataanalyst
JP Morgan SQL Interview Practice Question#datascience , #machinelearning #sql
มุมมอง 2443 หลายเดือนก่อน
JP Morgan SQL Interview Practice Question#datascience , #machinelearning #sql
Episode 6: Bayes Theorem
มุมมอง 355 หลายเดือนก่อน
Episode 6: Bayes Theorem
Episode 5:Conditional Probabilities and Independence
มุมมอง 205 หลายเดือนก่อน
Episode 5:Conditional Probabilities and Independence
Episode 4: Random Variables
มุมมอง 215 หลายเดือนก่อน
Episode 4: Random Variables
Episode 3: Probability: main idea behind probability distribution
มุมมอง 6935 หลายเดือนก่อน
Episode 3: Probability: main idea behind probability distribution
Episode 2: InterQuartile Range #statistics #data analyst #business analyst
มุมมอง 635 หลายเดือนก่อน
Episode 2: InterQuartile Range #statistics #data analyst #business analyst

ความคิดเห็น

  • @RITIKSINGH-re5ne
    @RITIKSINGH-re5ne 2 วันที่ผ่านมา

    Kindly provide create and insert statements ?

  • @swapnilbankar9797
    @swapnilbankar9797 10 วันที่ผ่านมา

    DENSE_RANK would be the most appropriate here. There wouldn't be a rank=2 if there are two orders with the same order value which is highest within a segment.

  • @tilu391
    @tilu391 12 วันที่ผ่านมา

    with cte as( select seat_number,occupancy, sum(occupancy) over ( partition by substr(seat_number,1,1) rows between 3 preceding and current row)as rnk from cinema_tickets ) select seat_number from cte where rnk=0 and right(seat_number,1) not in(1,2,3); simple answer

  • @Ananya-ji3uc
    @Ananya-ji3uc 16 วันที่ผ่านมา

    Expedia SQL Interview Question: Find all possible unique routes in the month of January

  • @HARSHRAJ-wz2rp
    @HARSHRAJ-wz2rp 16 วันที่ผ่านมา

    with cte as( select DISTINCT(DATE(Order_timestamp)) as time_stamp1 FROM Orders where DAYOFWEEK(order_timestamp)=2 ),cte2 as( SELECT time_stamp1, COALESCE( LEAD(time_stamp1) OVER (ORDER BY time_stamp1), ADDDATE(time_stamp1, 7) ) AS time_stamp2 FROM cte ),cte3 as( SELECT cte2.time_stamp1, COUNT(*) AS total_orders, COUNT(CASE WHEN Orders.is_defective = TRUE THEN 1 ELSE NULL END) AS x1, COUNT(CASE WHEN Orders.is_completed = TRUE THEN 1 ELSE NULL END) AS x2 FROM cte2 JOIN Orders ON Orders.order_timestamp BETWEEN cte2.time_stamp1 AND cte2.time_stamp2 GROUP BY cte2.time_stamp1 ) select time_stamp1,(x1/total_orders) as deffective_rate,(x2/total_orders) as effective_rate FROM cte3; Good question

  • @MubarakAli-qs9qq
    @MubarakAli-qs9qq 19 วันที่ผ่านมา

    Very good question

  • @MubarakAli-qs9qq
    @MubarakAli-qs9qq 19 วันที่ผ่านมา

    Mujse kyu ni bana😢

  • @MubarakAli-qs9qq
    @MubarakAli-qs9qq 21 วันที่ผ่านมา

    I always prefer cte

  • @MubarakAli-qs9qq
    @MubarakAli-qs9qq 21 วันที่ผ่านมา

    Bhot hard

  • @RITIKSINGH-re5ne
    @RITIKSINGH-re5ne 21 วันที่ผ่านมา

    Great explanation!f Kindly increase Screen resolution from next vid onwards or zoom in a little bit

  • @MubarakAli-qs9qq
    @MubarakAli-qs9qq 21 วันที่ผ่านมา

    Nice question

  • @krishnenduchakraborty750
    @krishnenduchakraborty750 22 วันที่ผ่านมา

    Thanks for sharing the Question & Solution. Your explanation is crystal clear. Keep it up. 😊👍

  • @abhinavkumar3356
    @abhinavkumar3356 หลายเดือนก่อน

    not to sound as creep but this is one of the most soothing voices I ever heard , please keep making such tutorial videos 🙂

  • @Ananya-ji3uc
    @Ananya-ji3uc หลายเดือนก่อน

    Okay to clarify it's inner join, the distinction between cross join and inner is that in cross join we get cartesian product whereas in inner join it's primarily intersection of records. Besides when two tables have same columns - we can skip ON keyword and use USING keyword. The play of keywords doesn't decide the type of join we are implementing

  • @yashagarwal9900
    @yashagarwal9900 หลายเดือนก่อน

    Somehow the example you've taken has made the concept of Joins in SQL much more complicated (I would stick with categorical examples). I believe you've showed an example of Cross Join rather than INNER Join buy not using an ON clause.

  • @yashagarwal9900
    @yashagarwal9900 หลายเดือนก่อน

    Shouldn't the syntax be "INTERVAL '6' DAY " instead of "INTERVAL '6 days' "?

    • @Ananya-ji3uc
      @Ananya-ji3uc หลายเดือนก่อน

      The syntax could vary I am using postgres sql

  • @siddhantgupta5301
    @siddhantgupta5301 หลายเดือนก่อน

    with cte as (select *, lag(occupancy,1) over(partition by substring(seat_number, 1, 1)) as prev_occ, lag(occupancy, 2) over(partition by substring(seat_number, 1, 1)) as prev_occ2, lag(occupancy, 3) over(partition by substring(seat_number, 1, 1)) as prev_occ3 from cinema_tickets) select concat(start_seat, '-', seat_number) as vacant from (select concat(substring(seat_number, 1, 1), substring(seat_number, 2, 2) - 3) as start_seat, seat_number from cte where occupancy = 0 and prev_occ = 0 and prev_occ2 = 0 and prev_occ3 = 0) a

  • @MusicalShorts-hn1px
    @MusicalShorts-hn1px หลายเดือนก่อน

    Could you please share the table creation commands in description box to practice these questions

    • @Ananya-ji3uc
      @Ananya-ji3uc หลายเดือนก่อน

      So this question is from practice site Datalemur : datalemur.com/questions/completed-trades Hope this helps:)

  • @vivekchaudhary5548
    @vivekchaudhary5548 หลายเดือนก่อน

    the last error was due to order of execution. You can't use alias name in where as "select" statement run after "where" clause. . . . . . . Btw your voice is ❤.

  • @pranavmalpani7355
    @pranavmalpani7355 หลายเดือนก่อน

    SELECT concat(seat,' to ',concat(left(seat,1),right(seat,1)+3)) as avaibable_seats FROM ( SELECT seat, ns1, ns2, ns3, ns4 FROM ( SELECT seat, occupancy AS ns1, LEAD(occupancy, 1) OVER(PARTITION BY LEFT(seat, 1) ORDER BY seat) AS ns2, LEAD(occupancy, 2) OVER(PARTITION BY LEFT(seat, 1) ORDER BY seat) AS ns3, LEAD(occupancy, 3) OVER(PARTITION BY LEFT(seat, 1) ORDER BY seat) AS ns4 FROM cinema_tickets ) AS s WHERE ns1 = 0 AND ns2 = 0 AND ns3 = 0 AND ns4 = 0 ) AS consecutive_empty_groups;

  • @wrestlingshorts
    @wrestlingshorts หลายเดือนก่อน

    The question says unique users so doesn't that contradict the solutions ?, let me know if i am wrong

    • @Ananya-ji3uc
      @Ananya-ji3uc หลายเดือนก่อน

      Hey @wrestlingshorts, could you explain contradict as in? So basically the question is if I am a user 'abc' and I have raised flags on videos say v1,v2 and v3, then query has to count those flags on each video.

  • @tensorthug6802
    @tensorthug6802 2 หลายเดือนก่อน

    Hey I'm an experienced machine learning engineer and I really appreciate what you're doing, keep going. All the best for your career.

  • @rajkumarpanigrahi2013
    @rajkumarpanigrahi2013 2 หลายเดือนก่อน

    Please solve some joins hard question

    • @Ananya-ji3uc
      @Ananya-ji3uc 2 หลายเดือนก่อน

      Sure will put up soon

  • @RITIKSINGH-re5ne
    @RITIKSINGH-re5ne 2 หลายเดือนก่อน

    Recommend at the right time preparing for a data analyst interview

    • @Ananya-ji3uc
      @Ananya-ji3uc 2 หลายเดือนก่อน

      All the Best!

  • @raashidnasim3803
    @raashidnasim3803 2 หลายเดือนก่อน

    Thank you for the video😊. Looking forward for more. A small request/suggestion the audio is barely audible.

    • @Ananya-ji3uc
      @Ananya-ji3uc 2 หลายเดือนก่อน

      Hey thanks for the input, that's work in progress

  • @chandravideo
    @chandravideo 3 หลายเดือนก่อน

    with cte as( SELECT *,cast(SUBSTRING(seat_number, 2, LEN(seat_number) - 1) as int) as sn, SUBSTRING(seat_number,1,1) as seat FROM cinema_tickets ),cte2 as( select *, lead(occupancy,1) over (partition by seat order by sn) as l1, lead(occupancy,2) over (partition by seat order by sn) as l2, lead(occupancy,3) over (partition by seat order by sn) as l3 from cte ) select seat_number,CONCAT(seat,sn+3) as succestive_next_seat from cte2 where occupancy+l1+l2+l3 = 0

    • @chandravideo
      @chandravideo 3 หลายเดือนก่อน

      A different approach

    • @Tech.S7
      @Tech.S7 หลายเดือนก่อน

      Yes it works for all dbs sql server N other dbs. For oracle in cte just change in first cte. Like below.... With cte as( Select t. *, TO_NUMBER (SUBSTR(seat_number, 2,LENGTH(seat_number)-1)) as sn, SUBSTR(t.seat_number, 1,1) as seat From cinema_tickets t And same you can continue from cte2

  • @blse2000
    @blse2000 3 หลายเดือนก่อน

    If any one is looking out purely based on CTE's ;WITH CTE AS (SELECT * FROM cinema_tickets WHERE occupancy = 0 ), CTE2 AS (SELECT seat_number AS seat_number, occupancy AS occupancy, CAST(SUBSTRING(SEAT_NUMBER, 2, 2) AS INT) - (ROW_NUMBER() OVER (PARTITION BY SUBSTRING(SEAT_NUMBER, 1, 1) ORDER BY CAST(SUBSTRING(SEAT_NUMBER, 2, 2) AS INT) ) ) AS RN FROM CTE ), CTE3 AS (SELECT SUBSTRING(seat_number, 1, 1) AS SUB, RN AS RN, COUNT(RN) AS C FROM CTE2 GROUP BY SUBSTRING(seat_number, 1, 1), RN HAVING COUNT(RN) = 4 ), CTE4 AS (SELECT SUBSTRING(CTE2.SEAT_NUMBER, 1, 1) AS SEAT_ROW, CAST(SUBSTRING(CTE2.seat_number, 2, 2) AS int) AS SEAT_NUM FROM CTE3 INNER JOIN CTE2 ON SUBSTRING(CTE2.SEAT_NUMBER, 1, 1) = CTE3.SUB AND CTE2.RN = CTE3.RN WHERE CTE3.C = 4 ) SELECT SEAT_ROW, CONCAT(SEAT_ROW, CAST(MIN(SEAT_NUM) AS varchar(5))) AS MIN_SEAT, CONCAT(SEAT_ROW, CAST(MAX(SEAT_NUM) AS varchar(5))) AS MAX_SEAT FROM CTE4 GROUP BY SEAT_ROW

  • @bhanusri493
    @bhanusri493 3 หลายเดือนก่อน

    The reason why she didn't get answer while using tab1 is you cannot use alias names along with where or having because according to order of execution Select statement will be executed after where/having is executed. So it do not recognize the new name that is assigned in select statement (which is not executed btw) . The approach of using tab2 is brilliant. Or you can directly use occupancy+s1+s2+s3 in where statement when using tab1. Just wanted to share.

  • @srinivasreddy8134
    @srinivasreddy8134 4 หลายเดือนก่อน

    Can i get pdf of this questions

  • @dravikrish7323
    @dravikrish7323 4 หลายเดือนก่อน

    How do we write if sales region max - each sales point of particular region? Example shop 1 revenue and total of all sales maximum of particular region?

    • @Ananya-ji3uc
      @Ananya-ji3uc 4 หลายเดือนก่อน

      If the question is to display region, shop1, shop1 revenue, max revenue for the region Then we can create a cte to get maximum according to each region. Join this cte with the sales table on region to display the output.

  • @yashagarwal9900
    @yashagarwal9900 4 หลายเดือนก่อน

    Thanks for posting DS content. Should one start from first video or are these random

    • @Ananya-ji3uc
      @Ananya-ji3uc 4 หลายเดือนก่อน

      these are interview relevant questions, part of Data Science Trivia playlist, it can be read in any order

  • @Playz-K6
    @Playz-K6 4 หลายเดือนก่อน

    Would you please tell me what do you refer to research on DS?

    • @Ananya-ji3uc
      @Ananya-ji3uc 4 หลายเดือนก่อน

      Hey @danishmaxable9661, I usually refer varied sources especially data science blogs and content online nothing specific though.

    • @Playz-K6
      @Playz-K6 4 หลายเดือนก่อน

      @@Ananya-ji3uc Thanks for the reply

  • @Rajkumar-xt7rj
    @Rajkumar-xt7rj 5 หลายเดือนก่อน

    with cte as (select cust_id,txn_date,cumm_tax, rank() over(order by cumm_tax) as rnk from (SELECT cust_id,txn_date,sum(txn_amt) over(partition by cust_id order by txn_date) as cumm_tax FROM customer_txn ) x where cumm_tax >=2000 ) select * from cte order by cust_id limit 1

  • @jhonsen9842
    @jhonsen9842 5 หลายเดือนก่อน

    You are just like me before solving this i did the same mistake

  • @hritickjain6318
    @hritickjain6318 6 หลายเดือนก่อน

    Different approach: with tab1 as( Select *, sum(occupancy) over(partition by substring(seat_number, 1,1) order by cast(substring(seat_number,2,len(seat_number)) as int) rows between current row and 3 following) as sum_4_prec, lead(seat_number,3) over(partition by substring(seat_number, 1,1) order by cast(substring(seat_number,2,len(seat_number)) as int)) as end_seat from cinema_tickets ) Select seat_number, end_seat from tab1 where end_seat is not null and sum_4_prec = 0

    • @vishalmane3139
      @vishalmane3139 18 วันที่ผ่านมา

      fck dude r u a human??

  • @priyankamalladi6262
    @priyankamalladi6262 6 หลายเดือนก่อน

    Engaging stuff!

  • @jennygupta8868
    @jennygupta8868 6 หลายเดือนก่อน

    Very innovative animation, great job👍 explained very well.

  • @emmimagnanaraj1085
    @emmimagnanaraj1085 6 หลายเดือนก่อน

    Informative video!

  • @strawhatnd1285
    @strawhatnd1285 6 หลายเดือนก่อน

    Great stuff

  • @prajaktamane9773
    @prajaktamane9773 7 หลายเดือนก่อน

    Was this asked in initial hackerrank test?

  • @harshpalsingh763
    @harshpalsingh763 8 หลายเดือนก่อน

    with cte as ( select *, sum(txn_amt) over(partition by cust_id order by txn_date ) as rolling_sum from customer_txn ) select cust_id,min(txn_date) as dates,min(rolling_sum) as rolling_sum from cte where rolling_sum>2000 group by cust_id this should give the same result

  • @jatinsingh7928
    @jatinsingh7928 9 หลายเดือนก่อน

    Good

  • @jatinsingh7928
    @jatinsingh7928 9 หลายเดือนก่อน

    Unclear problem statement

  • @dheemanjain8205
    @dheemanjain8205 10 หลายเดือนก่อน

    with cte1 as (select *,sum(txn_amt) over(partition by cust_id order by cust_id,txn_date,txn_amt) as rs from customer_txn), cte2 as (select *,rank() over(partition by cust_id order by txn_date) as rn from cte1 where rs>=2000) select cte2.cust_id,cte2.txn_date from cte2 where rn=1;

  • @gauravdhakad796
    @gauravdhakad796 10 หลายเดือนก่อน

    Can you share schema if you have?

  • @FunkyPretzel0911
    @FunkyPretzel0911 10 หลายเดือนก่อน

    Simple solution : Select * from (select case when A.occupancy+A.s1+A.s2+A.s3 = 0 then A.seat_number end as start_seat, case when A.occupancy+A.s1+A.s2+A.s3 = 0 then lead(A.seat_number,3) over() end as end_seat from (select seat_number,occupancy, lead(occupancy,1) over (partition by substr(seat_number,1,1)) s1, lead(occupancy,2) over(partition by substr(seat_number,1,1)) s2, lead(occupancy,3) over(partition by substr(seat_number,1,1)) s3 from cinema_ticket) A) B where B.start_seat is not null and B.end_seat is not null

  • @rawat7203
    @rawat7203 10 หลายเดือนก่อน

    My Solution with cte as( select cust_id, txn_date, running_total from( select cust_id, txn_date,txn_amt, sum(txn_amt) over(partition by cust_id order by txn_date rows between UNBOUNDED PRECEDING AND CURRENT ROW ) as running_total from customer_txn)temp1 where running_total >= 2000) select cust_id, min(txn_date) as date, min(running_total) as sum from cte group by cust_id

  • @emu9991
    @emu9991 11 หลายเดือนก่อน

    I like how raw this video is......and you also keep getting stuck at some points........as a newbie we always make mistakes and get confused.... you can try preparing well before recording videos.... it will give you more time to explain things better

    • @emu9991
      @emu9991 11 หลายเดือนก่อน

      i Still do not understand how using order by gives running sum whereas if not used , it gives the sum of the whole window.... pls let me know if you know the logic

    • @FunkyPretzel0911
      @FunkyPretzel0911 10 หลายเดือนก่อน

      @@emu9991 because it has partitioned by customer id now if u don't give order by condition , it sums up all amounts for id=101 if u give order by date , it'll look into 101's dates ascendingly and add one by one.

    • @abhinavkumar3356
      @abhinavkumar3356 หลายเดือนก่อน

      @@emu9991 according to me , by giving order by, you are giving a logic in the order to sum it, otherwise it would be just display the cumulative sum of the partition

  • @ank_kumar12
    @ank_kumar12 11 หลายเดือนก่อน

    with tab1 as (select *, row_number() over(partition by t5.cust_id) as ranks from (select * from (select cust_id,txn_date, sum(txn_amt) as amt, sum(sum(txn_amt)) over(partition by cust_id rows between unbounded preceding and current row) as c_sum from customer_txn group by cust_id,txn_date order by cust_id,txn_date) t where t.c_sum >= 2000) t5) select cust_id,txn_date,c_sum from tab1 where ranks = 1;