Git Product home page Git Product logo

sqlite3-examples's Introduction

Practice SQL queries with Python and sqlite3

You are using databases all the time, though you might not realize it. Even if you have never even queried a table, you almost certainly own a device which runs applications that use a lightweight database engine. By far the most widely used database engine is SQLite. It is so nearly ubiquitous that almost every mobile phone and web browser use it.

Are you a Python programmer, but not really proficient in SQL? You're in luck, because Python, adhering to it's philosophy of "batteries included", has support for SQLite built-in!

"Ah, but wait", I hear you saying, "does SQLite use the standard SQL languge?" The answer is yes..., well mostly anyway. "SQLite understands most of the standard SQL language. But it does omit some features while at the same time adding a few features of its own." If interested, read SQL As Understood By SQLite. In short, if you learn SQL using SQLite, then you will be able to interact with most any other database engine that supports standard SQL.

Below we'll go through some practical exercises with a simple dataset. I'll assume that the reader has intermediate Python skill but has little knowledge of SQL. We'll see how to create a database from a CSV file, and then how to add another table. We'll learn how to do queries, from simple ones to more complex ones.

Using sqlite3 from Python liberates me from the pain of setting-up and maintaining a client/server SQL database engine such as MySQL, or PostgreSQL. SQLite has a command-line interface, however since most data scientists will want to do further analysis on their query results, it makes sense to learn it from within the context of the Python interpreter. Whether you are just learning SQL and want to practice for that Data Scientist interview, or whether you have SQL experience and just want to see if sqlite3 has what you require, I hope you'll find these examples helpful.

CLICK HERE TO READ THE NOTEBOOK.

sqlite3-examples's People

Contributors

drforester avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.