Use Window Frames Like a PRO | SQL Intermediate Level Question

Pubblicato il: 10 agosto 2024
sul canale di: Select Star
168
12

Namastey All,

Welcome to Select Star. Today I am solving a medium level interview question.

We have been provided monthly sales and we are required to find :
1. Amount for the month
2. Total SUM till last month
3. Percentage

Topics covered :

1. Window Function SUM (RUNNING SUM)

2. Window Frames : ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING

3. GROUP BY

4. Aggregate function : SUM

5. OVER clause

6. ORDER BY

7. How to avoid LAG window function

8. COALESCE function

Related Playlists:

1. Basic SQL Course :
   • Basic SQL Course  

2. SQL Easy Interview Questions :
   • SQL Easy Interview Question  

3. SQL Mediun to Hard Level Interview Questions :
   • SQL Intermediate to Advanced Interview Que...  

If you want me to solve some specific questions, then email me :
ananttnegii@gmail.com

Script for table creation :

CREATE TABLE Transactions (TransactionDate DATE, Amount int);

INSERT INTO Transactions VALUES
('2023-01-01', 15000),
('2023-01-15', 17000),
('2023-02-08', 18000),
('2023-02-25', 20000),
('2023-02-28', 21000),
('2023-03-15', 24000),
('2023-04-10', 25000),
('2023-04-15', 30000),
('2023-05-01', 25500),
('2023-05-12', 20500),
('2023-05-18', 30500),
('2023-06-15', 31500),
('2023-07-01', 40500),
('2023-07-21', 45500),
('2023-08-15', 50500),
('2023-08-25', 30500),
('2023-09-29', 28000),
('2023-09-30', 78000),
('2023-10-01', 44000),
('2023-10-12', 66000),
('2023-10-15', 27000),
('2023-11-13', 57000),
('2023-12-01', 15000),
('2023-12-13', 24000);

select * from Transactions;

Happy Querying

#sql #data #dataanalytics #dataanalyst #analysis #analyst #dataengineers #dataengineering #machinelearning #datascience #datascientist #machinelearningengineer #businessanalyst #businessanalyticsjobs #businessanalytics #sqlserver #sqltips #sqlforbeginners #postgres #postgresql #mssqlserver #mssql #oracle #mysql #mysqltutorials #database #databasedesign #databasemanagement


In questa pagina del sito puoi guardare il video online Use Window Frames Like a PRO | SQL Intermediate Level Question della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Select Star 10 agosto 2024, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 168 volte e gli è piaciuto 12 spettatori. Buona visione!