Summary
Keywords
Full Transcript
Lead and Lag in sql In SQL, LEAD() and LAG() are window functions that allow you to access data from the next row (LEAD()) or previous row (LAG()) in a result set without using self-joins. They are useful for performing calculations that involve data from neighboring rows, such as finding differences between current and previous values. Want more similar videos- hit like, comment, share and subscribe ❤️Do Like, Share and Comment ❤️ ❤️ Like Aim 5000 likes! ❤️ ➖➖➖➖➖➖➖➖➖➖➖➖➖ Please like & share the video. ➖➖➖➖➖➖➖➖➖➖➖➖➖ script CREATE TABLE sales1 ( transaction_id INT, salesperson VARCHAR(50), transaction_date DATE, amount DECIMAL(10, 2) ); INSERT INTO sales1 (transaction_id, salesperson, transaction_date, amount) VALUES (1, 'Alice', '2023-01-01', 500.00), (2, 'Alice', '2023-01-03', 300.00), (3, 'Alice', '2023-01-05', 450.00), (4, 'Bob', '2023-01-02', 200.00), (5, 'Bob', '2023-01-06', 700.00), (6, 'Bob', '2023-01-08', 300.00); ➖➖➖➖➖➖➖➖➖➖➖➖➖ AWS DATA ENGINEER : https://www.youtube.com/playlist?list=PLOlK8ytA0MghpdMjb0m9zu1v9s_qbRP0q Azure data factory : https://youtube.com/playlist?list=PLOlK8ytA0MgguN5XidtQXbILxwCdJCUJE&si=iEICXHP80zGchUYh Azure data engineer playlist : https://youtube.com/playlist?list=PLOlK8ytA0MghBrzu0i6WlTBdoO1WdwV_e SQL PLAYLIST : https://www.youtube.com/playlist?list=PLOlK8ytA0MggGXIKmbfZ-_Xqcos3JKdV- PYSPARK PLAYLIST - https://www.youtube.com/playlist?list=PLOlK8ytA0MgjvOpd-088NRU_vTYw_aryH ➖➖➖➖➖➖➖➖➖➖➖➖➖ 📣Want to connect with me? Check out these links:📣 Join telegram to discuss https://t.me/+Cb98j1_fnZs3OTA1 ➖➖➖➖➖➖➖➖➖➖➖➖➖ what we have covered in this video: ➖➖➖➖➖➖➖➖➖➖➖➖➖ Hope you liked this video and learned something new :) See you in next video, until then Bye-Bye! ➖➖➖➖➖➖➖➖➖➖➖➖➖
