Database can be tested various ways,
If we are using SQL server then open the SQL query analyzer and write the queries to retrieve the data. Then verify whether the expected result is correct or not. IF not the data is not inserted into database.
We can play with queries to insert, update and delete the data from the data base and check in the front end of the application.
The general test process for DB testing is not very different from any other application. The following are the steps:
Step #1) Prepare the environment
Step #2) Run a test
Step #3) Check test result
Step #4) Validate according to the expected results
Step #5) Report the findings to the respective stakeholders
Usually SQL queries are used to develop the tests. The most commonly used command is the “Select”.
Select * from tablename where condition
Apart from select, SQL has 3 important types of commands:
DDL : Data definition language
DML: Data manipulation language
DCL: data control language
Let us see the syntax for the most commonly used statements.
Data Definition language: Uses CREATE, ALTER, RENAME, DROP and TRUNCATE to handle tables (and indexes).
Create table: Create table (field1 datatype(field size) ,……………..fieldn datatype(field size))
Data Manipulation language: Includes statements to add, update and delete records.
To insert a row into a DB: INSERT INTO (field1, field2, field3) VALUES (‘val1′, ‘val2’…’valn’);
Data control language: Deals with giving the authorization to users for manipulation and access to the data. Grant and Revoke are the two statements used.