All About SQLite

 

What is SQLite?

SQLite is an open source, zero-configuration, self-contained, stand-alone, transaction relational database engine designed to be embedded in an application.

SQLite is an embedded relational database management system used in the mobile applications. SQLite is different from other SQL databases because unlike most other SQL databases, SQLite does not have a separate server process.

Features of SQLite

  1. SQLite is Free
  2. SQLite is Serverless
  3. SQLite is very flexible
  4. SQLite supports SQL
  5. Configuration is not required
  6. SQLite is cross-platform
  7. Storing Data is easy
  8. SQLite API is largely available for all the popular languages

Why We Really Need It?

SQLite is lightweight data so it can be easily and efficiently used in embedded software for devices like television, mobile phones, camera or electronic devices. CRUD Operation is easy and efficient. So, It won’t lag in performance.

When app developer needs store data in the local database,  then SQLite is the best solution to achieve it.

Is It is Cross-Platform?

Yes, It is independent of platforms. You can use it in Android, iOS, Windows Phone or Tizen. Almost all the mobile OS has their own native API for accessing SQLite database. Since there is an abstract behavior in accessing data in real database, so we ‘ll use an open-source app i.e. SQLite browser to pre-fill or operate operations in GUI

SQLite Browser

A GUI tool which will handle SQLite database and handle operations which SQLite supports. Basically, It ‘ll help you in exploring data inside the database or prepare the pre-filled database for the app.

Operations SQLite Browser can Perform 

  1. Open Existing Database and perform CRUD Operations
  2. Create New Database and perform CRUD Operations
  3. Search Records from the Database Data
  4. Import and Export as Text File, CSV or SQL Dumps
  5. Perform SQL Query and generate result against it.
  • Open Existing DataBase

Setp1. Download and Install SQLite Browser (http://sqlitebrowser.org/) on your mac.

Step2.  You’ll get something like this window and click on ‘Open Database‘. I’m assuming you have a dummy database or, just create a New Database from the window tab.

 

Step3. Choose the .db file which is basically a SQLite file

 

Step4. You’ll get your Database Schema and Tables Data. As I have the table named ‘student‘ where table’s attributes are listed in DB Schema Section of the window.

Step5. If you want to insert new record then, you move to Browse Data and click on New Record. Click on the fields and insert data against it.

What if, you want to edit the schema (structure) of the table or delete the table. Then, you move to Database Structure, right-click on the table and there you have Modify Table, Delete Table, and Export as CSV.

 

  • Export & Import Your Database as 
  1. Different SQLite (*.db) file
  2. as CSV File

  • Create New Database

Step1.

Click on New Database and name the file.

Step2.

You ‘ll get an Edit Table Definition Window where you define the schema of Table.

First, Name the Table and click on Add Field to add the Column Name of the table.

And, when you add fields it will automatically generate SQL for you in the lower window.

When you’re done, you have to go into Browse Data and fill the database with actual data.

  • Perform SQL Query

Just like any RDBMS supported database, you can perform SQL Query on it.

Conclusion

SQLite is not a light-weight database which is used in mobile devices, refrigerators, and electronic devices. Every application can maintain a database when they need to store data locally in the database like feature. Most Important, every mobile platform supports it say, Android, iOS, Windows Phone, Tizen or Xamarin (Hybrid). Everyone has their own native library to perform database operations.

 

Leave a Reply