question archive Hello Tutors,I will be requiring help on this SQL problem
Subject:Computer SciencePrice: Bought3
Some social networks, including Twitter and Instagram, allow one user (a "follower") to follow another user (a "followee"). Let's consider how such networks might represent data about their users. A social network might, for instance, have a SQL database with tables like the below.
CREATE TABLE users ( id INTEGER, username TEXT UNIQUE, name TEXT, PRIMARY KEY(id) ); CREATE TABLE followers ( follower_id INTEGER, followee_id INTEGER, FOREIGN KEY (follower_id) REFERENCES users(id), FOREIGN KEY (followee_id) REFERENCES users(id) );
Assume that Ileana is registered for this social network with a username of ileana, that Reese is registered with a username of reese, and that Max is registered with a username of max.
Social networks like Twitter and Instagram support asymmetric relationships: Alice might follow Bob, but that does not mean that Bob also follows Alice. Other social networks, like Facebook, support symmetric relationships as well: in order for Alice and Bob to be "friends," one of them must send a "friend request" to the other, which the other must then accept.