Find out about Connecting to SQL Server 2017 from RStudio
Read about Derived Tables here.
How do I randomise the link to a pick-list, so that the lookup goes to a different value with each run? Find out here.
Read about Cross-Server Queries.
Read about Cross Joins and Self Joins.
Read about: Return, WaitFor, GoTo.
Read about Table and Column Aliasing.