Question
Write the following SQL SELECT statements for the twitter database a) List the followers of the user with the ID 123. [5 points] b) How
Write the following SQL SELECT statements for the twitter database a) List the followers of the user with the ID 123. [5 points]
b) How many followers does the user with the user name HillaryClinton have? [10 points]
c) Find the user with the largest number of followers. [5 points]
d) How many tweets does each user have in the data base? [10 points]
5
e) Find the users who do not write any tweets. [5 points]
f) Create a list of all users with the number of Tweets and the number of followers. [5 points]
g) BONUS: You decide that an appropriate importance score for users is the number of tweets times the number of followers. Who are the 10 most important users in the database? [Additional 10 points]
h) How do foreign keys prevent deletion anomalies? [5 points]
3) Given is a twitter database with tables created by the following statements: CREATE TABLE Tweet ( ID integer PRIMARY KEY, userlD integer, content text, FOREIGN KEY (userlD) REFERENCES User CREATE TABLE User (ID integer PRIMARY KEY, age integer, username text) nteger, usename tex CREATE TABLE Follows ( followerlD integer, followingID integer, PRIMARY KEY (followerID, followingID) FOREIGN Key (followerID) REFERENCES User, FOREIGN Key (followingID) REFERENCES User Draw the ER Model implemented in this data base. [10 points]
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started