The reason behind %%sql

Why do we require %%sql on its own line to start the query?

https://app.dataquest.io/c/43/m/257/guided-project%3A-analyzing-cia-factbook-data-using-sql/3/overview-of-the-data

Those %% make it possible to run SQL queries in Jupyter Notebook.

They are called magic commands that offer additional functionalities that might not be [easily] possible with python. You can read more about them here - Built-in magic commands — IPython 7.26.0 documentation if you’d like to.