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

🎵 Irl - Lizzo & Sza 🎵 Illegal - Pinkpantheress 🎵 Eternity - Alex Warren 🎵 Perfect - Ed Sheeran 🎵 Starships - Nicki Minaj 🎵 Golden - Huntr/X, Ejae, Audrey Nuna, Rei… 🎵 Sorry Im Here For Someone Else - Benson… 🎵 Gangnam Style - Psy 🎵 4X4 - Travis Scott 🎵 Blink Twice - Shaboozey & Myles Smith 🎵 The Door - Teddy Swims 🎵 Go Baby - Justin Bieber