TIDE
Languages

SQLite

Installing SQLite CLI and C libraries on Ubuntu in TIDE

SQLite

SQLite is a C-language library that implements a small, fast, self-contained, high-reliability, full-featured SQL database engine.

Installation

Install the command-line interface (sqlite3) and development header files (libsqlite3-dev):

sudo apt update
sudo apt install -y sqlite3 libsqlite3-dev

Verification

Check the installed CLI version:

sqlite3 --version

Writing and Running SQL Code

Using the SQLite CLI

Create a SQL script file named hello.sql:

hello.sql
CREATE TABLE greetings (message TEXT);
INSERT INTO greetings VALUES ('Hello, World from SQLite!');
SELECT * FROM greetings;

Execute the SQL script against a database file (or in-memory):

sqlite3 test.db < hello.sql

Using C API

Create a C file named main.c:

main.c
#include <stdio.h>
#include <sqlite3.h>

int main() {
    printf("SQLite Version: %s\n", sqlite3_libversion());
    return 0;
}

Compile and run with gcc:

gcc main.c -lsqlite3 -o hello_sqlite
./hello_sqlite

Official Resources

On this page