MP3JOSS

MySQL: ROLLUP

MySQL: ROLLUP

Choose Download Format

Download MP3 Download MP4

Details

TitleMySQL: ROLLUP
AuthorBro Code
Duration3:50
File FormatMP3 / MP4
Original URL https://youtube.com/watch?v=6FwQBS3jV_I

Description

#MySQL #tutorial #course

-- ROLLUP, extension of the GROUP BY clause
-- produces another row and shows the grand-total (super-aggregate) value

SELECT SUM(amount) AS "daily_sales", order_date
FROM transactions
GROUP BY order_date WITH ROLLUP;

SELECT COUNT(transaction_id) AS "# of orders", order_date
FROM transactions
GROUP BY order_date WITH ROLLUP;

SELECT COUNT(transaction_id) AS "# of orders", customer_id
FROM transactions
GROUP BY customer_id WITH ROLLUP;

SELECT SUM(hourly_pay) AS "hourly_pay", employee_id
FROM employees
GROUP BY employee_id WITH ROLLUP;

🎧 Just For You

🎵 Giddy Up, Gorgeous - Tanner Adell 🎵 Sexy And I Know It - Lmfao 🎵 Go Baby - Justin Bieber 🎵 Party Rock Anthem - Lmfao Feat. Lauren… 🎵 Die With A Smile - Lady Gaga & Bruno Mars 🎵 Love The Way You Lie - Eminem Feat… 🎵 Irl - Lizzo & Sza 🎵 Old Town Road - Lil Nas X Feat. Billy Ray… 🎵 Just The Way You Are - Bruno Mars 🎵 4X4 - Travis Scott 🎵 Catch These Fists - Wet Leg 🎵 Tau Mich Auf - Zartmann