You will start with a very simple but common query—finding all users followed by a given user. In the relational approach, the following code returns all users followed by the user with the username @MilosSQL:
SELECT t2.UserNameFROM dbo.TwitterUser t1 INNER JOIN dbo.UserFollows uf ON t1.UserId = uf.UserIdINNER JOIN dbo.TwitterUser t2 ON t2.UserId = uf.FollowingUserIdWHERE t1.UserName = '@MilosSQL';
The resulting list contains four usernames:
UserName----------------------@DejanSarka@sql_williamd@tomaz_tsql@WienerSportklub
The same result can be achieved by using the new MATCH clause, as in the following code:
SELECT t2.UserNameFROM dbo.TwitterUser t1, dbo.TwitterUser t2, dbo.FollowsWHERE MATCH (t1-(Follows)->t2) AND t1.UserName ...