Refering to a local table with SQL


I am new to RStudio, and have been searching across the internet for an answer for this question for days. Now I turn to the RStudio Community for help. Apologies if my question is ill-formed, as I am new to programming like this.

I am using SQL in RStudio with File -> New File -> SQL Script. What I want to know is, how can I create a local table not within a database I have established a connection with.

For instance, if I write:

create table testTable as
FROM obj_table

then the table will be created in the database I have a connection with. However, I merely want to create it as a temporary table for using in the code that would follow.

In WPS, for instance, I could write it as "create table work.testTable" specifying that it would be a temporary table, and later I could refer to it withing SQL the same way. Is something similar possible within RStudio?
Otherwise by using SQL in RStudio, how could I first load a table from a local drive, and then join it with a table from the database I have a connection with?


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.