O'Reilly logo

Practical Predictive Analytics by Ralph Winters

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Changing to the SQL API

You can change to the SQL interface by coding %sql on the first line. That allows all subsequent code statements in that particular notebook cell to be interpreted as SQL only.

If you wish to return to another language in a subsequent cell, enter %r, %python, %scala, and so on as the first line of the cell. If you do not enter one of these magic directives, it will be interpreted in the syntax of the default notebook type (in this case, R).

Here is the version of the count sample_bin query that we performed earlier in R, but now purely in the SQL interface. The results are shown as a pivot table. If you wish, you can manipulate the format by selecting the raw data icon (the first one on the left, below the data), or ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required