Atlas › 15 SQL & Database Testing › Data Manipulation☰ Read as one page
Data Manipulation
3.1OverviewSetting up test data directly in the database is faster than going through the UI or API. INSERT, UPDATE, and DELETE let you create precise…3.2INSERT: Creating Test DataFor complex test scenarios (user with 100 orders, specific date distributions, edge-case data), SQL is orders of magnitude faster.3.3UPDATE: Modifying Test State3.4DELETE: Cleaning UpForeign key constraints prevent deleting a parent record while child records exist. If you try to delete a user who has orders, the…3.5Transactions: The Safety NetTransactions ensure that test data changes are atomic (all or nothing) and can be rolled back.3.6Safe Practices3.7Bulk Data GenerationFor performance testing or large data set scenarios:3.8Practical Exercise1. Write INSERT statements to create a user with 3 orders and 2 line items per order 2. Write a cleanup script that deletes all test data…3.9Key Takeaways- Direct SQL is the fastest way to create test data - Always clean up in reverse dependency order (children before parents) - Transaction…