SQL cell
To easily query SQL databases, Workspace allows you to add SQL cells to your notebook. The result of your SQL query will be stored as a data frame and available in your session for further analysis. SQL cells are supported in DataCamp's notebook editor in both R and Python workspaces.
To write SQL in Workspace:
  • Open a notebook file in DataCamp's Notebook Editor.
  • Click "Add SQL cell" at the bottom of the notebook (or on "Add SQL cell" when hovering on the area in between two cells).
  • Select the integration that accesses the database you want to query:
    • You can create a new integration, see What is an integration?
    • If you don't have a SQL database to connect to, you can select one of the sample integrations.
  • (Optional) Update the variable name of the data frame that will hold the result of your SQL query by updating the field behind "Available as". If you don't set this, the query result will be available as a data frame called df.
  • Write the SQL query.
  • Click "Run" in the cell menu (or use the shortcuts).
Example of a running a query against the Lego sample integration. The query result is vailable as df.

Copy link