Question: Create a view called tStat with columns writer, tdate, ttime, text, rep _ cnt , ret _ cnt , and sim _ cnt; the view

Create a view called tStat with columns writer, tdate, ttime, text, rep_cnt, ret_cnt, and sim_cnt; the view would include for every tweet, the id of the writer, tdate, ttime, text, the number of replies, the number of retweets and the number of tweets that mention the same hashtag mentioned in the tweet. Note: To pass github tests, please insert "select * from tStat" after creating your query.
for the following schema:
CREATE TABLE users ( usr int, name text, email text, timezone float, phone int, primary key (usr)); CREATE TABLE follows ( flwer int, flwee int, start_date date, primary key (flwer,flwee), foreign key (flwer) references users, foreign key (flwee) references users ); CREATE TABLE hashtags ( term text, primary key (term)); CREATE TABLE urls ( shorttxt text, longtxt text, PRIMARY KEY (shorttxt)); CREATE TABLE tweets ( writer int, tdate date, ttime time, text text, replyto_w int, replyto_d date, replyto_t time, mention_url text, mention_has text, PRIMARY KEY (writer, tdate, ttime), FOREIGN KEY (writer) REFERENCES users, FOREIGN KEY (mention_url) REFERENCES urls, FOREIGN KEY (mention_has) REFERENCES hashtags, FOREIGN KEY (replyto_w, replyto_d, replyto_t) REFERENCES tweets ); CREATE TABLE retweets ( retweeter int, writer int, tdate date, ttime time, spam int, rdate date, PRIMARY KEY (retweeter, writer, tdate, ttime), FOREIGN KEY (retweeter) REFERENCES users, FOREIGN KEY (writer, tdate, ttime) REFERENCES tweets ); CREATE TABLE lists ( owner int, lname text, color text, PRIMARY KEY (owner, lname), FOREIGN KEY (owner) REFERENCES users ON DELETE CASCADE ); CREATE TABLE includes ( owner int, lname text, writer int, tdate date, ttime time, PRIMARY KEY (owner, lname, writer, tdate, ttime) FOREIGN KEY (owner, lname) REFERENCES lists, FOREIGN KEY (writer, tdate, ttime) REFERENCES tweets );

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!