How to Test SQL Queries


Here we’ll learn How to test sql queries. SQL queries are a way to formulate the desired data from your database. This data can either be from a single table, or may be some kind of an operation between multiple tables. We test sql queries in order to check if our queries work or not.

SQL queries prove two things. One, that your database is connected with your environment. Two, it supports and backs up your database structure, and schema. It helps to gain business knowledge, and provides absolute and derived statistics. On high levels, queries are also used to understand the snapshot of a single transaction taken place in the database.

Step # 1 – Writing SQL query

Open up your management studio, right click on your database, and click new query. Type the following query in the text field: “select Name from ado.tbl_name where Id=1;”

Writing select SQL query

Step # 2 – Executing the Query

Now inorder to test sql queries, click on execute on the top to see the result. If there are no problems, the results will be displayed and the query will be tested.

executing select query

Step # 3 – Writing all SQL query

Let’s try another query. Now write “select * from ado.tbl_name;” in the text field.

writing all SQL query

Step # 4 – Executing the Query

Click on execute on the top to see the result.

executing all SQL query

And that’s all for How to test sql queries in ASP.net.