AI Chat Assistant

Modifying Data with AI Chat Assistant

Modifying Data with AI Chat Assistant

WhoDB's AI Chat Assistant enables you to modify database records using natural language while maintaining strict safety controls. Every data modification operation requires explicit confirmation before execution, preventing accidental changes to your database.

Understanding AI-Powered Data Modification

The AI Chat Assistant translates your natural language instructions into SQL statements for data modifications and schema changes (INSERT, UPDATE, DELETE, CREATE, ALTER, DROP). Unlike read-only queries, these operations follow a confirmation workflow to ensure safety.

Key Safety Features

Explicit Confirmation Required

All data modifications and schema changes (INSERT, UPDATE, DELETE, CREATE, ALTER, DROP) require manual confirmation before execution

Operation Preview

See exactly what SQL will execute before confirming

Action Feedback

Clear confirmation when operations complete successfully

Error Handling

Detailed error messages if modifications fail

How the Confirmation Workflow Works

INSERT Operations - Adding Records

Use natural language to add new records to your tables. The AI assistant generates appropriate INSERT statements based on your table schema.

text

Create a new product named Laptop with price 999.99, category Electronics, and stock 50

The AI generates:

sql

INSERT INTO products (name, price, category, stock)
VALUES ('Laptop', 999.99, 'Electronics', 50)

The inline confirmation appears; click Show Query to verify the table, columns, and values before confirming.

Best Practices for INSERT Operations

UPDATE Operations - Modifying Records

Update existing records by describing what should change and which records to affect.

text

Update the email for user with id 5 to newemail@example.com

The AI generates:

sql

UPDATE users SET email = 'newemail@example.com' WHERE id = 5

Conditional and bulk updates work the same way: "Set all products in Electronics category to have discount 10" generates an UPDATE with the matching WHERE clause.

When the confirmation appears, pay special attention to the WHERE clause.

After confirming, verify the "Action Executed" message, then run a follow-up SELECT to confirm the intended records changed.

Best Practices for UPDATE Operations

DELETE Operations - Removing Records

Delete operations require the most caution as they permanently remove data. Like all modifications, DELETE requests go through the inline confirmation before anything executes.

text

Delete user with id 5

The AI generates the statement and shows the inline confirmation:

sql

DELETE FROM users WHERE id = 5

Conditional deletions ("Delete all inactive users", "Remove all log entries older than 90 days") follow the same pattern. Click Show Query to review the DELETE statement and its WHERE clause, then Confirm to execute or Cancel to abort. Afterwards, run a follow-up SELECT to confirm the records are gone.

Best Practices for DELETE Operations

Understanding Confirmation Prompts

The inline confirmation is your final checkpoint before data modification.

What the Confirmation Shows

Checklist Before Confirming

  • The SQL targets the intended table and schema
  • For UPDATE and DELETE, the WHERE clause targets the correct records
  • For INSERT and UPDATE, values are correct and properly formatted
  • The number of rows likely affected matches your expectation
  • A WHERE clause exists unless you truly intend to affect all records

Verifying Modifications

After executing a modification, verify the changes were applied correctly.

Rollback Strategies

Plan recovery before making data modifications.

Prevention is Best

Test in Development

Practice modifications in a development database first

Use Transactions

Run critical operations in transaction blocks (via Scratchpad)

Regular Backups

Maintain frequent database backups for recovery

Soft Deletes

Use status flags instead of permanent deletion where possible

If You Make a Mistake

Using Transactions for Safety

For critical modifications, use the Scratchpad to wrap operations in transactions:

sql

BEGIN;

UPDATE users SET status = 'inactive' WHERE last_login < '2023-01-01';

-- Review the affected rows
SELECT * FROM users WHERE status = 'inactive' AND last_login < '2023-01-01';

-- If everything looks correct:
COMMIT;

-- If something is wrong:
ROLLBACK;

Safety Practices for Production Data

The essentials when modifying production databases:

  • Verify your connection — confirm you're on the correct database (production vs. development)
  • SELECT before you modify — understand the current state and estimate the affected row count
  • Check backups — ensure recent backups exist and have been tested
  • Start small — for bulk operations, test with a single record first
  • Verify each step — check results after each modification before proceeding
  • Schedule bulk operations — perform large modifications during maintenance windows

For the full set of production guidelines, change management checklists, and audit considerations, see AI Chat Assistant Best Practices.

Common Modification Patterns

The core pattern for every safe modification is preview → modify → verify:

The same three-step shape applies to inserts (check the record doesn't exist, insert, confirm it was created), deletions (preview, delete, confirm records are gone), and cleanups. For records with dependencies — such as deleting a user who has orders — handle the related records first, then the parent record.

Troubleshooting

Comparing AI Chat vs. Traditional Methods

Scenario
AI Chat Assistant
Traditional UI
Scratchpad SQL
Quick single record change
Fast and convenient
Multiple clicks required
Overkill for simple changes
Bulk updates with conditions
Natural language, easy
Must use SQL
Most control and visibility
Complex multi-table operations
May require multiple steps
Not supported
Best option
Production-critical changes
Good with careful review
Limited capabilities
Recommended for control

Security Considerations

What's Sent to AI Providers: your natural language request, database schema (table and column names), and database type.

What's NOT Sent: actual data values, query results, or existing record contents.

For maximum privacy, use local models (Ollama, LM Studio) for complete data isolation, avoid mentioning sensitive values in your requests, and use Scratchpad for modifications involving sensitive data.

Audit and Compliance: Modifications are associated with the database user credentials used, so database-level logs can attribute changes. Enable your database's audit or query logging for comprehensive tracking.

Permission Management: Follow the principle of least privilege — use database users with only necessary permissions, read-only users for exploration, and separate credentials for production vs. development. See AI Chat Assistant Best Practices for read-only user setup.

Next Steps

Querying Data

Learn how to retrieve and analyze data without modifications

Conversation Features

Master multi-turn conversations for complex operations

Scratchpad Queries

Use SQL directly for complex modifications requiring transactions

AI Best Practices

The canonical guide to safe and effective AI assistant usage