You can override the primary language by specifying the language magic command %<language> at the beginning of a cell. The supported magic commands are: %python, %r, %scala, and %sql. References: https://docs.databricks.com/user-guide/notebooks/notebook-use.html#mix-languages