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, repcnt retcnt and simcnt; 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, startdate date, primary key flwerflwee 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, replytow int, replytod date, replytot time, mentionurl text, mentionhas text, PRIMARY KEY writer tdate, ttime FOREIGN KEY writer REFERENCES users, FOREIGN KEY mentionurl REFERENCES urls, FOREIGN KEY mentionhas REFERENCES hashtags, FOREIGN KEY replytow replytod replytot 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
