In this section, you can run a SQL statement to create a table and work with data using SQL Statements:
- Copy and paste this code snippet into the notebook cell to see a list of the Azure Databricks datasets:
display(dbutils.fs.ls("/databricks-datasets"))
- The code appears as follows:
DROPTABLEIFEXISTS diamonds;
CREATETABLE diamonds
USING csv
OPTIONS (path "/databricks-datasets/Rdatasets/data-001/csv/ggplot2/diamonds.csv", header "true")
- Press Shift + Enter. The notebook automatically attaches to the cluster you created in Step 2, creates the table, loads the data, and returns OK:
- Next, you can run a SQL statement to query the table for the average diamond price by color.
- To add a cell to the Notebook, hover over the cell bottom and click the icon:
- Copy this snippet and paste it into the cell:
SELECT color, avg...