Queries with Joins and Aggregations (044)
CREATE TABLE users(
id SERIAL PRIMARY KEY,
username VARCHAR(50)
);
CREATE TABLE photos (
id SERIAL PRIMARY KEY,
url VARCHAR(200),
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE
);
CREATE TABLE comments (
id SERIAL PRIMARY KEY,
contents VARCHAR(240),
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE,
photo_id INTEGER REFERENCES photos(id) ON DELETE CASCADE
);
INSERT INTO users (username)
VALUES
('Reyna.Marvin'),
('Micah.Cremin'),
('Alfredo66'),
('Gerard_Mitchell42'),
('Frederique_Donnelly');
INSERT INTO photos (url, user_id)
VALUES
('https://santina.net', 3),
('https://alayna.net', 5),
('https://kailyn.name', 3),
('http://marjolaine.name', 1),
('http://chet.net', 5),
('http://jerrold.org', 2),
('https://meredith.net', 4),
('http://isaias.net', 4),
('http://dayne.com', 4),
('http://colten.net', 2),
('https://adelbert.biz', 5),
('http://kolby.org', 1),
('https://deon.biz', 2),
('https://marina.com', 5),
('http://johnson.info', 1),
('https://linda.info', 2),
('https://tyrique.info', 4),
('http://buddy.info', 5),
('https://elinore.name', 2),
('http://sasha.com', 3);
THERE IS ANOTHER INSERT INTO MISSING, CHECK THE SUBSEQUENT VIDEOS COMMENTS FOR IT.
-
2:00:08
Game On!
10 hours agoThursday Night Football Week 2: Bill at Dolphins Preview and Best Bets!
7.58K2 -
10:40
Evenout
21 hours agoTattoo Artist Meltdown
17.5K5 -
1:06:01
The Illusion of Consensus
2 days agoHow Pharmaceutical Companies Control the Narrative with Sharyl Attkisson
18.3K3 -
3:18
Cooking with Gruel
1 day agoFine Dining Quality One-Pan Chicken in 20 minutes
17.2K2 -
1:15:12
Andy Frisella
23 hours agoIs Kamala Harris' Support Real or Are the Numbers Being Skewed? - Ep 775 CTI
17.1K18 -
35:05
Degenerate Jay
19 hours agoGoodbye James Earl Jones - The Voice Of Darth Vader
14.7K8 -
1:07:42
ReasonTV
23 hours agoHow NPR lost its way | Mike Pesca | The Reason Interview With Nick Gillespie
16.7K7 -
10:10
GameLeap RAID Shadow Legends
22 hours agoBEST TIME EVER to Start a New Raid Account?! 4 FREE CHAMPIONS and Beginner Promo Codes (2024)
16.9K3 -
4:06:26
Alex Zedra
13 hours agoLIVE! Just Chatting
45.4K10 -
3:13:26
Fresh and Fit
11 hours agoAfter Hours w/ HangingWithKen
141K64