/
SQLite Fundamentals
Save to my account
Sign up
Report Bug
SQLite Fundamentals
SQLite Fundamentals
Study
Question
What is SQLite and what are its main characteristics?
Answer
SQLite is a lightweight, standalone, serverless relational database engine created in 2000. It is embedded directly into applications, written in C, open source, compact (less than 500 KB), and stores all data in a single flat file, making it easy to manage without server configuration.
Question
How does SQLite differ from traditional database systems like MySQL or PostgreSQL?
Answer
Unlike traditional databases that require a separate server process, SQLite does not need any server configuration; database operations are embedded directly within the application, and all data is stored in a single file.
Question
Why is SQLite particularly important for mobile applications?
Answer
SQLite efficiently manages data by organizing large amounts in a structured way, accelerates searching and updating data, ensures data persistence across app sessions, and is used in applications like contact managers, note-taking apps, and browsing history.
Question
What is a database and how are data organized within it?
Answer
A database stores information in a structured and organized manner based on a schema that defines how data is interconnected. It contains entities called tables, each grouping similar information for easier management.
Question
What are the components of a table in a database?
Answer
A table consists of tuples (or records), which are the rows representing unique entries, and attributes, which are the columns representing specific types of information for each record.
Question
List and describe the main data types used in SQLite.
Answer
1. INTEGER: whole numbers (e.g., 1, -5), 2. REAL: floating-point decimal numbers (e.g., 3.14), 3. TEXT: character strings (e.g., 'Alice'), 4. BLOB: raw binary data like images or audio, 5. NULL: represents the absence of a value.
Question
What makes SQLite's data typing system different from other databases?
Answer
SQLite uses dynamic typing, meaning values stored are not strictly limited to the declared column type. For instance, a column declared as INTEGER can hold TEXT values, though this might reduce consistency.
Question
What is the basic syntax for creating a table in SQLite?
Answer
CREATE TABLE table_name ( column_name1 DATA_TYPE, column_name2 DATA_TYPE, ... ); where you define each column and its data type before adding data.
Question
Provide an example of a SQL command to create a 'Utilisateur' table with an auto-incrementing ID and columns for name, age, and job.
Answer
CREATE TABLE Utilisateur ( ID INTEGER PRIMARY KEY AUTOINCREMENT, Nom TEXT NOT NULL, Age INTEGER, Metier TEXT );
Question
What are CRUD operations in the context of SQLite and what does each do?
Answer
CRUD stands for Create, Read, Update, and Delete, which are fundamental operations for managing data: Create adds new data, Read retrieves data, Update modifies existing data, and Delete removes data from tables.
Question
Give an example of how to insert new data into the 'Utilisateur' table in SQLite.
Answer
INSERT INTO Utilisateur (Nom, Age, Metier) VALUES ('Rachid', 29, 'Développeur'); inserts a new record with name 'Rachid', age 29, and job 'Développeur'.