/Practice-SQL-with-SQLite-and-Jupyter-Notebook

Practice basic SQL syntax with Jupyter notebook. SQL is particularly useful in handling structured data where there are relations between different entities/variables of the data. SQL is a very important tool for data scientists to have in their repertoire.

Primary LanguageJupyter NotebookMIT LicenseMIT

Practice-SQL-with-SQLite-and-Jupyter-Notebook

Practice basic SQL syntax with Jupyter notebook. SQL is particularly useful in handling structured data where there are relations between different entities/variables of the data. SQL is a very important tool for data scientists to have in their repertoire.

In this tutorial, we will practice

  1. How to create/connect a SQLite database
  2. How to create a table from scratch/from an existing table
  3. How to drop a table
  4. How to insert data into/update a table
  5. How to retrieve data
  6. How to do maths across table columns
  7. How to aggregate data
  8. How to join tables
  9. How to create/drop views to simplify queries
  10. How to deal with NULLs
  11. How to convert query results into Pandas's DataFrame
  12. How to rollback and commit a transaction (this one used the sqlite3 package as ipython_sql does not support transactions).
  13. (Bonus)How to access a SQLite database directly with Pandas
  14. Dealing with date and time.

It is worth noting that this tutorial mainly focuses on how to retrieve data from a database, instead of database management. That is also why we slected SQLite rather than more complicated Databases such as MySQL or PostgreSQL, etc.

Moreover, this SQLite tutorial would not cover everything about SQLite. Some important features are left to be explored by users such as triger and tansaction, primary or foreigh index, etc.

The most efficient way to master SQL is to keep practicing through extensive hands-on practices. Hope that you could start using SQLite effectively and comfortably.

April/2021

Window Functions based on the latest version of SQLite and add an extra tutorial

  1. s03-Window Functions within SQLite