> For the complete documentation index, see [llms.txt](https://qatesting.gitbook.io/qa/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://qatesting.gitbook.io/qa/database-testing/test-cases.md).

# Test Cases

#### Manual Test Case&#x20;

<table data-full-width="true"><thead><tr><th width="136">Test Case ID</th><th>Test Case Description</th><th width="323">Test Steps</th><th width="196">Expected Results</th><th>Actual Results</th><th>Pass/Fail</th></tr></thead><tbody><tr><td>TC-001</td><td>Verify data integrity</td><td>1. Retrieve a record from the database.<br>2. Modify a value in the record.<br>3. Update the record in the database.<br>4. Retrieve the updated record from the database.</td><td>The modified value should be reflected in the updated record.</td><td></td><td></td></tr><tr><td>TC-002</td><td>Verify data validation</td><td>1. Attempt to insert a record with invalid data into the database.<br>2. Attempt to update a record with invalid data in the database.</td><td>The database should reject the invalid data and return an error message.</td><td></td><td></td></tr><tr><td>TC-003</td><td>Verify data security</td><td>1. Attempt to access the database without proper authentication.<br>2. Attempt to access a record in the database that the user does not have permission to access.</td><td>The database should deny access and return an error message.</td><td></td><td></td></tr><tr><td>TC-004</td><td>Verify performance</td><td>1. Insert a large number of records into the database.<br>2. Retrieve a large number of records from the database.<br>3. Update a large number of records in the database.<br>4. Delete a large number of records from the database.</td><td>The database should be able to handle the operations within an acceptable timeframe without slowing down or crashing.</td><td></td><td></td></tr></tbody></table>

## Scenario:

You are a database administrator for a company that sells products online. You have a database that contains information about products, customers, orders, and shipments. Your goal is to ensure that the database is reliable, efficient, and secure.

#### Test Cases:

<table data-full-width="true"><thead><tr><th>Test Case</th><th>Explanation</th><th>Application to Scenario</th></tr></thead><tbody><tr><td>Verify that a new record can be added to the database.</td><td>This tests whether the database can successfully add new data.</td><td>Add a new product to the database.</td></tr><tr><td>Verify that a record can be updated in the database.</td><td>This tests whether the database can successfully modify existing data.</td><td>Update the price of a product in the database.</td></tr><tr><td>Verify that a record can be deleted from the database.</td><td>This tests whether the database can successfully remove data.</td><td>Delete a customer record from the database.</td></tr><tr><td>Verify that a record can be retrieved from the database.</td><td>This tests whether the database can successfully retrieve data.</td><td>Retrieve the order history for a specific customer.</td></tr><tr><td>Verify that a table can be created in the database.</td><td>This tests whether the database can successfully create a new table.</td><td>Create a new table to track product reviews.</td></tr><tr><td>Verify that a table can be dropped from the database.</td><td>This tests whether the database can successfully delete a table.</td><td>Drop the table that tracks abandoned shopping carts.</td></tr><tr><td>Verify that a unique constraint can be added to a table.</td><td>This tests whether the database can successfully enforce uniqueness on a column.</td><td>Add a unique constraint to the email column in the customer table.</td></tr><tr><td>Verify that a foreign key constraint can be added to a table.</td><td>This tests whether the database can successfully enforce referential integrity between tables.</td><td>Add a foreign key constraint to the order table that references the customer table.</td></tr><tr><td>Verify that a primary key constraint can be added to a table.</td><td>This tests whether the database can successfully enforce uniqueness and non-nullability on a column.</td><td>Add a primary key constraint to the product table that uses the product ID column.</td></tr><tr><td>Verify that a check constraint can be added to a table.</td><td>This tests whether the database can successfully enforce a custom condition on a column.</td><td>Add a check constraint to the order table that ensures the order amount is greater than zero.</td></tr><tr><td>Verify that a trigger can be created on a table.</td><td>This tests whether the database can successfully execute a custom action on a table.</td><td>Create a trigger on the shipment table that sends an email notification to customers when their order is shipped.</td></tr><tr><td>Verify that a view can be created in the database.</td><td>This tests whether the database can successfully create a virtual table based on other tables.</td><td>Create a view that shows the total revenue generated by each product.</td></tr><tr><td>Verify that a stored procedure can be created in the database.</td><td>This tests whether the database can successfully create a reusable block of code.</td><td>Create a stored procedure to update the inventory levels of a product based on recent orders.</td></tr><tr><td>Verify that a user can be granted permissions on a table.</td><td>This tests whether the database can successfully manage access to data.</td><td>Grant a customer service representative permission to view customer records.</td></tr><tr><td>Verify that a user can be denied permissions on a table.</td><td>This tests whether the database can successfully restrict access to data.</td><td>Deny a marketing analyst permission to view sales data.</td></tr><tr><td>Verify that a backup can be created for the database.</td><td>This tests whether the database can successfully create a copy of the data for disaster recovery.</td><td>Create a backup of the database every night at midnight.</td></tr><tr><td>Verify that a restore can be performed on the database.</td><td>This tests whether the database can successfully recover from a backup.</td><td>Restore the database from a backup after a hardware failure.</td></tr><tr><td>Verify that a database can be detached from the server.</td><td>This tests whether the database can successfully be removed from the server for maintenance.</td><td>Detach the database from the server to install a software update.</td></tr><tr><td>Verify that a database can be attached to the server.</td><td>This tests whether the database can successfully be added back to the server after maintenance.</td><td>Attach the database back to the server after completing the software update.</td></tr><tr><td>Verify that a database can be renamed.</td><td>This tests whether the database can successfully be given a new name.</td><td>Rename the database to reflect a recent rebranding of the company.</td></tr><tr><td>Verify that a database can be shrunk.</td><td>This tests whether the database can successfully reduce its size.</td><td>Shrink the database to free up disk space.</td></tr><tr><td>Verify that a database can be expanded.</td><td>This tests whether the database can successfully increase its size.</td><td>Expand the database to accommodate increased traffic during a holiday sale.</td></tr><tr><td>Verify that a database can be optimized.</td><td>This tests whether the database can successfully improve its performance.</td><td>Optimize the database by rebuilding indexes and updating statistics.</td></tr><tr><td>Verify that adatabase can be backed up while in use.</td><td>This tests whether the database can successfully create a backup while users are accessing it.</td><td>Create a backup of the database during business hours to ensure continuous availability.</td></tr><tr><td>Verify that a database can be migrated to a new server.</td><td>This tests whether the database can successfully move to a different server.</td><td>Migrate the database to a new server with better performance and reliability.</td></tr><tr><td>Verify that a database can be replicated.</td><td>This tests whether the database can successfully create copies to improve performance and availability.</td><td>Replicate the database to a secondary server for load balancing and failover.</td></tr><tr><td>Verify that a database can be mirrored.</td><td>This tests whether the database can successfully create a secondary copy for disaster recovery.</td><td>Mirror the database to a secondary server for automatic failover in case of a primary server failure.</td></tr><tr><td>Verify that a database can be clustered.</td><td>This tests whether the database can successfully be distributed across multiple servers for high availability.</td><td>Cluster the database across multiple servers to ensure continuous availability and scalability.</td></tr><tr><td>Verify that a database can be secured.</td><td>This tests whether the database can successfully protect against unauthorized access and attacks.</td><td>Secure the database by implementing strong passwords, encryption, and access controls.</td></tr></tbody></table>
