0
$\begingroup$

I'm having a little fun and I'd love to know how to write a SQL or dwSQL query across these two datasets of Trumps tweets and Facebook posts. Here are the datasets:

Trump Facebook Posts https://data.world/dave/trumps-facebook-statuses

Trump Tweets https://data.world/dave/trump-tweets

Ideally I would like to be able to count the distinct instances that a word or phrase (like 'crooked' or 'massive' or 'the best' appeared across both datasets.

The table name for the Facebook Post dataset is TrumpFacebook and for the Trump Tweets is trump_tweets.

$\endgroup$
2
  • 1
    $\begingroup$ what kind of things have you tried so far? $\endgroup$ – Mohammad Athar Oct 21 '16 at 15:49
  • $\begingroup$ Please add what you tried and which DB you are using for SQL since some syntax is different per DB. $\endgroup$ – Stereo Oct 22 '16 at 16:48
1
$\begingroup$

Have you tried something like this in SAS?

PROC SQL;
 CREATE TABLE TRUMP_FB_TWEETS AS
 SELECT *
 FROM TRUMP_FB
 UNION CORRESPONDING ALL
 SELECT *
 FROM TRUMP_TWEETS;
QUIT;

Source:http://www2.sas.com/proceedings/sugi25/25/cc/25p109.pdf

$\endgroup$
2
  • 1
    $\begingroup$ Welcome to the Data science SO, the opp is asking for a SQL solution not SAS. Very few people have access to SAS so I would recommend to phrase this as a general SQL solution. $\endgroup$ – Stereo Oct 22 '16 at 16:45
  • $\begingroup$ SAS University is a free download, but I can see your point. $\endgroup$ – AbbyPaden Oct 23 '16 at 0:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.