diff --git a/iteration2/tables.sql b/iteration2/tables.sql index 04709aee11ae839c28c527c075cd313b36bc1a9e..01f60c61595d7aa4126da95e3e9834f47aa6cdbc 100644 --- a/iteration2/tables.sql +++ b/iteration2/tables.sql @@ -44,4 +44,23 @@ CREATE TABLE public."tweetedWith" CONSTRAINT "FremdschluessselTweetedWith2" FOREIGN KEY ("Hashtag2") REFERENCES public."Hashtag" (text) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION -) \ No newline at end of file +) + +\\ Zur Abfrage für die Relation tweetedWith (mit pgadmin exportiert und dann wieder importiert) +SELECT +DISTINCT h1.text, +h2.text +FROM +public.has h1, +public.has h2 +WHERE +h1."ID" = h2."ID" AND +h1.text != h2.text; + +\\ Zur Abfrage für die Relation Hashtag (mit pgadmin exportiert und dann wieder importiert) +SELECT +has.text,Count(has.text) as amountTweets +FROM +public.has +GROUP BY +has.text; \ No newline at end of file