Developing and Designing Queries Using Query Designer in SQL Server 2012

Today, I have provided an article showing you how to develop and design queries using the Query Designer in SQL Server 2012. Many new developers don't want to write queries directly. This is because they don't know the SQL syntax. To build a query with the Query Designer, you don't need to remember the SQL syntax to write queries against your database. Joining tables can be created by clicking and dragging fields in specific tables to fields in other tables. This is very useful when creating complex queries that involve many tables, views etc.

How to Design a Query( build a query with the Query Designer)

First select a database from the top of Management Studio and press Ctrl+N or click New Query from the top of Management Studio to open the query window.

img1.jpg

Now open the Query Designer. This can be opened in one of two ways:

  1. You can right-click in the query window and select "Design Query in Editor".
  2. Select Query Menu from the top of Management Studio.

img2.jpg

Now click on Design Query in the editor.

img7.jpg

Within the Query Designer, you will have the option of selecting the database tables that you would like to query. Suppose we want to select the two tables Registration and News from the "Add Table" window. So select the tables and click on the "Add" button to add the tables into the designing window; the result will be:

img3.jpg

Now select the columns you want to display in your query: Suppose we select all the columns from the table News and select the userid from the Registration table.

img4.jpg

Now click on the OK Button to see the query in the Query window.

img5.jpg


Similar Articles