MP3JOSS

MySQL: GROUP BY

MySQL: GROUP BY

Choose Download Format

Download MP3 Download MP4

Details

TitleMySQL: GROUP BY
AuthorBro Code
Duration5:08
File FormatMP3 / MP4
Original URL https://youtube.com/watch?v=FztbYXeOEQ4

Description

#MySQL #tutorial #course

You can copy and paste all of the following statements if you would like to follow along in this video.
P.S. Make sure you have a customers table if you're linking the foreign key on customer_id.
------------------------------------------------------------
DROP TABLE IF EXISTS transactions;

CREATE TABLE transactions (
transaction_id INT PRIMARY KEY AUTO_INCREMENT,
amount DECIMAL(5, 2),
customer_id INT,
order_date DATE,
FOREIGN KEY (customer_id)
REFERENCES customers(customer_id)
);

INSERT INTO transactions
VALUES (1000, 4.99, 3, "2023-01-01"),
(1001, 2.89, 2, "2023-01-01"),
(1002, 3.38, 3, "2023-01-02"),
(1003, 4.99, 1, "2023-01-02"),
(1004, 1.00, NULL, "2023-01-03"),
(1005, 2.49, 4, "2023-01-03"),
(1006, 5.48, NULL, "2023-01-03");

SELECT * FROM transactions;
------------------------------------------------------------

00:00:00 intro
00:00:16 data for this demo
00:00:00 GROUP BY
00:03:19 HAVING
00:04:36 conclusion

🎧 Just For You

🎵 Manchild - Sabrina Carpenter 🎵 Pink Pony Club - Chappell Roan 🎵 Soda Pop - Saja Boys 🎵 Rolling In The Deep - Adele 🎵 Apt. - Ros & Bruno Mars 🎵 Daisies - Justin Bieber 🎵 Afterlife - Alex G 🎵 Midnight Sun - Zara Larsson 🎵 Nuevayol - Bad Bunny 🎵 Blink Twice - Shaboozey & Myles Smith 🎵 Shake It To The Max (Fly) - Moliy, Silent… 🎵 Sex On Fire - Kings Of Leon