SQLite Database

Learn how to use ForgeZap's built-in SQLite database to store and manage your application data. Create tables, manage records, and build data-driven applications.

Built-in Database

ForgeZap includes a powerful SQLite database that's perfect for storing application data, user records, and content. No external database setup required.

Database Overview

Key Features

Data Management

  • • Create and manage tables
  • • Add, edit, and delete records
  • • Run SQL queries
  • • Data validation and constraints

Integration

  • • Connect to components
  • • Real-time data updates
  • • Form data submission
  • • Data table display

Database Access

Access from the Data Sources section
Create and manage tables
Query data with SQL

Creating Tables

Table Creation Process

Navigate to Data Sources → Database
Click "Create New Table"
Define table name and fields
Set field types and constraints
Save and start adding data

Field Types

Text Fields

  • • TEXT - Variable length text
  • • VARCHAR - Fixed length text
  • • EMAIL - Email validation
  • • URL - URL validation

Numeric Fields

  • • INTEGER - Whole numbers
  • • REAL - Decimal numbers
  • • CURRENCY - Money values
  • • PERCENTAGE - Percentage values

Date & Time

  • • DATE - Date only
  • • DATETIME - Date and time
  • • TIMESTAMP - Auto-updating timestamp

Special Fields

  • • BOOLEAN - True/false values
  • • JSON - Structured data
  • • FILE - File references
  • • RELATION - Links to other tables

Managing Data

Adding Records

Use forms to add new records
Import data from CSV files
Add records manually in the database view

Editing Records

Edit records directly in data tables
Use forms for structured editing
Bulk edit multiple records

SQL Queries

ForgeZap supports SQL queries for advanced data operations. Use the query builder or write custom SQL to retrieve and manipulate data.

Basic Queries

Select All Records

sql
SELECT * FROM customers;

Filter Records

sql
SELECT * FROM customers 
WHERE status = 'active' 
ORDER BY created_at DESC;

Join Tables

sql
SELECT c.name, o.total 
FROM customers c 
JOIN orders o ON c.id = o.customer_id;

Data Manipulation

Insert Records

sql
INSERT INTO customers (name, email, phone) 
VALUES ('John Doe', 'john@example.com', '555-0123');

Update Records

sql
UPDATE customers 
SET status = 'inactive' 
WHERE last_login < '2024-01-01';

Delete Records

sql
DELETE FROM customers 
WHERE status = 'inactive' 
AND created_at < '2023-01-01';

Connecting to Components

Data Table Component

Connect data tables to display database records:

Select Data Table component
Go to Data tab in properties
Choose "SQLite Database" as source
Select table and configure columns

Form Components

Connect forms to save data to database:

Create form with input fields
Set up form submission workflow
Configure database save action
Map form fields to database columns

Best Practices

Table Design

Plan your table structure carefully. Use appropriate field types, add indexes for frequently queried fields, and establish relationships between tables.

Data Validation

Use field constraints and validation rules to ensure data quality. Set required fields, unique constraints, and data type validations.

Performance

For large datasets, use efficient queries with proper WHERE clauses and indexes. Consider pagination for data tables with many records.