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

🎵 Just Keep Watching - Tate Mcrae 🎵 Dont You Worry Child - Swedish House… 🎵 Irl - Lizzo & Sza 🎵 Love All Night - Amo & Aymen 🎵 Rolling In The Deep - Adele 🎵 Beautiful People - David Guetta & Sia 🎵 Love Me Not - Ravyn Lenae 🎵 Survive - Lewis Capaldi 🎵 Shake It To The Max (Fly) - Moliy, Silent… 🎵 Not Like Us - Kendrick Lamar 🎵 Dior - Mk & Chrystal 🎵 Let Her Go - Passenger