Interactive SQLite Database

SQLite Browser

Run SQL queries directly in your browser - no server needed!

Sample Database Schema

This demo includes three tables:

Students Table

  • id (INTEGER PRIMARY KEY)
  • name (TEXT)
  • email (TEXT)
  • major (TEXT)
  • gpa (REAL)

Courses Table

  • id (INTEGER PRIMARY KEY)
  • course_code (TEXT)
  • course_name (TEXT)
  • credits (INTEGER)

Enrollments Table

  • id (INTEGER PRIMARY KEY)
  • student_id (INTEGER)
  • course_id (INTEGER)
  • grade (TEXT)

Try These Queries

Basic Queries:

-- Get all students
SELECT * FROM students;

-- Filter by major
SELECT * FROM students WHERE major = 'Computer Science';

-- Sort by GPA
SELECT name, gpa FROM students ORDER BY gpa DESC;

Join Queries:

-- Student enrollments with course names
SELECT s.name, c.course_name, e.grade 
FROM students s 
JOIN enrollments e ON s.id = e.student_id 
JOIN courses c ON e.course_id = c.id;

-- Students without enrollments
SELECT s.name FROM students s 
LEFT JOIN enrollments e ON s.id = e.student_id 
WHERE e.id IS NULL;

Aggregations:

-- Average GPA by major
SELECT major, ROUND(AVG(gpa), 2) as avg_gpa, COUNT(*) as students
FROM students 
GROUP BY major;

-- Course enrollment counts
SELECT c.course_name, COUNT(e.id) as enrolled
FROM courses c
LEFT JOIN enrollments e ON c.id = e.course_id
GROUP BY c.id;

Data Modifications:

-- Insert new student
INSERT INTO students (name, email, major, gpa) 
VALUES ('New Student', 'new@university.edu', 'Engineering', 3.5);

-- Update a grade
UPDATE enrollments SET grade = 'A+' WHERE id = 1;

-- Delete a record
DELETE FROM enrollments WHERE id = 8;

All changes are stored locally in your browser session!