Skip to main content

Why SQLite?

  • What is SQLite?
  • Features of SQLite
  • Advantages
  • Limitations
  • SQLite Data Types

Practice

Explain why SQLite is called a serverless database.

SQL Command Categories

DDL (Data Definition Language)

Purpose: Defines and modifies the structure of database objects. Commands
  • CREATE
  • ALTER
  • DROP

Practice

DDL commands change the database schema by creating, modifying, or deleting database objects.

DML (Data Manipulation Language)

Purpose: Inserts, updates, and deletes data stored in tables. Commands
  • INSERT
  • UPDATE
  • DELETE

Practice

DML commands work with the data inside existing tables.

DQL (Brief Introduction)

  • SELECT
  • Covered in detail in the next chapter.

TCL (Brief Introduction)

  • BEGIN
  • COMMIT
  • ROLLBACK

SQLite Data Types

Practice

Choose the appropriate SQLite data type for:
  • Age → INTEGER
  • Salary → REAL
  • Name → TEXT

Creating Tables

Syntax

Explanation

  • PRIMARY KEY — Uniquely identifies each row.
  • NOT NULL — Prevents NULL values.
  • FOREIGN KEY — Creates a relationship with another table.

Practice

Create a student table with student_id, student_name, and email.

ALTER TABLE

Used to modify an existing table.

Add a Column

Rename a Column

Practice

Add a phone column to the employee table.

DROP TABLE

Deletes an entire table permanently.
Note: All data in the table is permanently deleted.

Practice

Delete the student table.

INSERT Statement

Used to insert new rows into a table.

Insert a Single Row

Insert Multiple Rows

Insert by Specifying Columns

Practice

Insert an employee named Anitha with a salary of 55000.

UPDATE Statement

Used to modify existing records.

Syntax

Important: Always use a WHERE clause unless you intend to update every row.

Practice

Increase Rahul’s salary to ₹75,000.

DELETE Statement

Deletes one or more rows.
Important: Omitting the WHERE clause deletes all rows.

Practice

Delete the employee named Sneha.

Summary

In this chapter, you learned:
  • SQLite basics
  • SQL command categories
  • SQLite data types
  • CREATE TABLE
  • ALTER TABLE
  • DROP TABLE
  • INSERT
  • UPDATE
  • DELETE
The next chapter focuses entirely on DQL (SELECT), where you’ll learn how to retrieve and analyze data from the database.