> ## Documentation Index
> Fetch the complete documentation index at: https://shivamgoyal.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Add Data to Database

> Learn how to add, import, and manage data in your CodeNull database

# Adding Data to Your Database

After creating your database, the next step is to populate it with data. CodeNull provides several methods to add and manage data in your database without writing complex database queries.

## Methods for Adding Data

<CardGroup cols={3}>
  <Card title="Manual Entry" icon="keyboard">
    Create records one at a time through the interface
  </Card>

  <Card title="Bulk Import" icon="file-import">
    Import data from CSV, Excel, JSON, or other formats
  </Card>

  <Card title="AI Generation" icon="robot">
    Generate sample data using AI for testing
  </Card>

  <Card title="API Integration" icon="plug">
    Connect to external data sources via APIs
  </Card>

  <Card title="Form Submissions" icon="clipboard-list">
    Create frontend forms that add data to your database
  </Card>

  <Card title="Data Migration" icon="exchange-alt">
    Transfer data from another database
  </Card>
</CardGroup>

## Manual Data Entry

The Data Explorer interface allows you to create individual records manually:

<Steps>
  <Step title="Open Collection/Table">
    In your database dashboard, click on the collection or table where you want to add data.
  </Step>

  <Step title="Create New Record">
    Click the "Add Record" button in the top-right corner of the Data Explorer.
  </Step>

  <Step title="Enter Field Values">
    Complete the form with values for each field in your collection/table schema.

    <Frame>
      <img src="https://mintlify.s3.us-west-1.amazonaws.com/shivamgoyal/images/add-record-form.png" alt="Add Record Form" />
    </Frame>
  </Step>

  <Step title="Validate and Save">
    Click "Validate" to check for any errors, then "Save" to add the record to your database.
  </Step>
</Steps>

<Tip>
  When entering data manually, you can use the "Clone" button to create similar records quickly. This is useful when adding multiple records with slight variations.
</Tip>

## Bulk Data Import

For adding multiple records at once, use the Bulk Import feature:

<Steps>
  <Step title="Access Import Tool">
    From your collection/table view, click "Import" in the toolbar.
  </Step>

  <Step title="Select Import Method">
    Choose your data source:

    * Upload a file (CSV, Excel, JSON)
    * Paste data (JSON, CSV format)
    * Connect to external source
  </Step>

  <Step title="Configure Mapping">
    Map the imported data fields to your database schema fields.

    <Frame>
      <img src="https://mintlify.s3.us-west-1.amazonaws.com/shivamgoyal/images/data-mapping-interface.png" alt="Data Mapping Interface" />
    </Frame>

    For each imported column, you can:

    * Match to an existing field
    * Transform data during import
    * Skip certain columns
    * Handle special data types (dates, geo coordinates, etc.)
  </Step>

  <Step title="Validation Options">
    Configure how to handle validation issues:

    * Skip invalid records
    * Attempt to fix common issues
    * Stop import on any error
    * Create a validation report
  </Step>

  <Step title="Execute Import">
    Click "Start Import" to begin the process. A progress indicator will show the status.
  </Step>

  <Step title="Review Results">
    After import completes, review the summary showing:

    * Number of records imported successfully
    * Any validation issues encountered
    * Fields that required transformation
  </Step>
</Steps>

## AI-Generated Test Data

CodeNull can generate realistic test data based on your schema:

<Steps>
  <Step title="Access AI Data Generator">
    From your collection/table view, click "Tools" → "Generate Test Data".
  </Step>

  <Step title="Configure Generator">
    Set parameters for your test data:

    * Number of records to generate
    * Value ranges and patterns
    * Relationships between records
    * Scenarios to simulate (e.g., e-commerce transactions)
  </Step>

  <Step title="Preview Generated Data">
    Review a sample of the data that will be generated and adjust settings as needed.
  </Step>

  <Step title="Generate and Import">
    Click "Generate" to create the test data and add it to your database.
  </Step>
</Steps>

## Form-Based Data Collection

To collect data from users through your application:

<Steps>
  <Step title="Create Form in Frontend">
    Use the Frontend Dashboard to create a form component connected to your database.
  </Step>

  <Step title="Configure Data Mapping">
    Map form fields to database fields, including validation rules.
  </Step>

  <Step title="Set Up Form Processing">
    Configure what happens when the form is submitted:

    * Direct database entry
    * API processing before storage
    * Email notifications
    * Confirmation messages
  </Step>

  <Step title="Test Form Submission">
    Test the form to ensure data is correctly saved to your database.
  </Step>
</Steps>

## Managing Existing Data

CodeNull provides tools to work with your existing data:

### Data Explorer Interface

<Frame>
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/shivamgoyal/images/data-explorer-interface.png" alt="Data Explorer Interface" />
</Frame>

The Data Explorer allows you to:

* Browse records with filtering and sorting
* Edit individual field values
* Delete or archive records
* Export selected records
* View data relationships

### Batch Operations

Perform operations on multiple records at once:

* Update field values across many records
* Delete records matching certain criteria
* Export filtered data sets
* Run data transformations

<AccordionGroup>
  <Accordion title="Batch Update Example">
    To update a field across multiple records:

    1. Use filters to select the target records
    2. Click "Batch Update" in the toolbar
    3. Select the field to update
    4. Enter the new value or transformation rule
    5. Preview changes before applying
    6. Confirm to update all matching records
  </Accordion>

  <Accordion title="Conditional Batch Delete">
    To delete records matching specific criteria:

    1. Create a filter for the records to delete
    2. Click "Batch Delete" in the toolbar
    3. Review the affected records count
    4. Choose between hard delete or soft delete (archive)
    5. Confirm deletion with any required verification
  </Accordion>
</AccordionGroup>

## Best Practices

<Tip>
  Start with a small set of test data to verify your schema design before importing large datasets.
</Tip>

* **Use descriptive IDs**: Create readable identifiers for important records
* **Validate before import**: Check data quality before adding to your database
* **Document data sources**: Track where your data came from for future reference
* **Test with realistic data**: Use data that resembles production use cases
* **Backup before bulk operations**: Create database backups before large data changes

## Next Steps

After adding data to your database, explore these next steps:

* [Design and optimize your database schema](/database-dashboard/schema-design)
* [Set up data migration workflows](/database-dashboard/data-migration)
* [Connect your database to frontend components](/frontend-dashboard/component-toolbox)
