SQLite Introduction


This entry is part 1 of 4 in the series SQLite

Wikipedia says: “SQLite is a relational database management system (RDBMS) contained in a C library. In contrast to many other database management systems, SQLite is not a client–server database engine. SQLite does not require a server (it is serverless). Rather, it is embedded into the end program.” This is very important. As a software developer, know that SQLite can be inserted into your project so that you can ship your DB right in the EXE file! For more information you can go to the SQLite website.

There is a program called DB Browser for SQLite that allows you to easily create, design, and edit SQLite database files. Who is “you”? DB4S is for users and developers who want to create, search, and edit databases. The DB Browser for SQLite website has lots of information.

SQLite is the most popular relational database system in the world. With SQLite, the database is integratated with the application locally and it doesn’t need to remotely contact a server. It is therefore fast. With no server, we don’t need any SQL drivers to be installed. SQLite is self-contained, meaning that it does not require many external libraries or much support from the operating system. You therefore can use SQLite on many different platforms, including embedded devices such as mobile phones, gaming consoles and more.

Data Types

What are the data types of SQLite? You can shorted INTEGER to INT in your CREATE TABLE statements.

  • NULL – The value is a NULL value.
  • INTEGER – The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value.
  • REAL – The value is a floating point value, stored as an 8-byte IEEE floating point number.
  • TEXT – The value is a text string, stored using the database encoding (UTF-8, UTF-16BE or UTF-16LE)
  • BLOB – The value is a blob of data, stored exactly as it was input

sqlite3 in Python

In Python, all we need to do is import the sqlite3 library and we’re ready. It’s very easy to set up and again, it’s very fast.

There is an educational YouTube video on SQLite called Using SQLite in C# – Building Simple, Powerful, Portable Databases for Your Application. Tim Corey shows us how to create a small simple Windows program with a list of people’s names. Tim uses SQLite in a C# project. He first talks about SQLite at time 4:30 in the video. He then talks about DB Browser for SQLite at time 5:09.

Tutorial

Have a look at the SQLite tutorial at www.sqlitetutorial.net. There is also a SQLite sample database that is the Chinook database.

Series NavigationSQLite DB Browser >>