The following example uses ipython-sql. To install:pip install ipython-sql
%sql is a Jupyter magic command and can be ignored when not using Jupyter notebooks.
#connect to sqlite
%%sql CREATE TABLE players (first_name, last_name, age);
%%sql INSERT INTO players (first_name, last_name, age) VALUES ('Lebron', 'James', 33), ('Steph', 'Curry', 30);
%%sql --Select all records from our table 'players', to confirm we inserted rows SELECT * FROM players
Get better at data science interviews by solving a few questions per week
Find a bug? Submit a suggested change on Github, or message me on Twitter.