Queries with Joins and Aggregations (044)
MicroUrb
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. ... https://www.youtube.com/watch?v=3dRCmtn2d6o
11754326 Bytes